Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect java build path entry for serial.jar with Eclipse Plugin (Ubuntu 11.04) #767

Closed
processing-bugs opened this issue Feb 10, 2013 · 3 comments

Comments

@processing-bugs
Copy link

Original author: alan.hig...@gmail.com (June 16, 2011 15:01:15)

I'm just getting started with Processing, using the Processing plugin in Eclipse.

Ubuntu 11.04
Eclipse 3.5.2
Processing Plug-In for Eclipse 0.3.1.201010191219

I've got a very simple 'sketch' that works, until I try to import the serial libraries.

eg:

void setup(){
// screen size
size(300,315);
}

void draw(){
ellipse(50,50,80,80);
}

as soon as I add the import command, it fails:

import processing.serial.*;

void setup(){
// screen size
size(300,315);
}

void draw(){
ellipse(50,50,80,80);
}

The preprocessed output shows the red 'x' on the import line, saying 'The import processing.serial cannot be resolved

When checking Java Build Path/libraries in the project properties, I see that the serial library is trying to be included, but the path and filename are wrong.

The filename (which should be "serial.jar") is listed as "O.jar"
The path (which should end in "...Resources/libraries/serial/library") actually ends in "...Resources/libraries/serial/library/Serial I(missing)"

The issue is that the name of the library is "Serial I/O". In linux, this name is interpreted as a folder called "Serial I" and a file called "O".

The solution is to edit the file "...Resources\libraries\serial\library\export.txt" and change the first line from

name = Serial I/O

to

name = serial

I reloaded Eclipse at this point, but it may not be necessary. The red 'x' in the preprocessed file disappeared and both code fragments executed identically.

Original issue: http://code.google.com/p/processing/issues/detail?id=728

@processing-bugs
Copy link
Author

From alan.hig...@gmail.com on June 16, 2011 19:07:37
Rather than open a second ticket, I'm commenting on this one.

This solution only works when there isn't any serial code other than the import statement. As soon as any actual serial calls are made, the program blows up because it can't find a class definition for SerialPortEventListener.

For example, this code (from the serial.list() page on processing.org) complains with java.lang.NoClassDefFoundError: gnu/io/SerialPortEventListener:

// Example by Tom Igoe

import processing.serial.*;

// The serial port
Serial myPort;

// List all the available serial ports
println(Serial.list());

I've determined that there also needs to be a java build path library entry for the RXTXcomm.jar file, and that entry needs to include the location of the native resources for that library.

Unfortunately, the plugin ships with native resources for windows (dll) and mac(jnilib), but not for linux(so).

In contrast, the regular processing distribution (I downloaded v1.5.1) has native resources for macosx,windows32,windows64,linux32 and linux64

A workaround is to manually add the reference to both RXTXcomm.jar and the appropriate native resources (in my case, processing-1.5.1/modes/java/libraries/serial/library/linux32/librxtxSerial.so). The extremely unfortunate part is that the plugin refreshes the java build path values during each build, so this sequence of steps must be performed after each build, which is a huge pain.

A thread that led me in the right direction can be found here:

http://processing.org/discourse/yabb2/YaBB.pl?num=1170029680

@processing-bugs
Copy link
Author

This issue is a duplicate of #1031

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 18, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant