Compiling the latest version of classes.jar

This is where you talk about the NXJ software itself, installation issues, and programming talk.

Moderators: 99jonathan, roger, imaqine

Compiling the latest version of classes.jar

Postby Eric » Mon Nov 23, 2009 9:26 pm

Recently, I downloaded the latest (post-0.85 release) source from the Sourceforge repository for classes.jar. The source compiled without a hitch, using the ant build file included in the source.

My next step was to try and include the new classes.jar in one of my projects in Eclipse. It seemed to work OK, as all of the new classes were availiable in the intellisense (or is that VS?) thing.

Unfortunately, the LeJOS plugin's "upload to brick" menu item gives me the helpful warning in the console that "something went wrong [...]". Any ideas why this might be?
User avatar
Eric
Novice
 
Posts: 63
Joined: Sat Oct 24, 2009 5:07 pm
Location: UK

Re: Compiling the latest version of classes.jar

Postby Shawn » Tue Nov 24, 2009 8:27 am

Eric wrote:Unfortunately, the LeJOS plugin's "upload to brick" menu item gives me the helpful warning in the console that "something went wrong [...]". Any ideas why this might be?


Hi,

Did it work before trying the updated classes.jar?

What OS?

How are you trying to upload? USB? bluetooth?

Is there anymore info available on the error?

What version of java are you using (32 or 64 bit)?
User avatar
Shawn
Advanced Member
 
Posts: 723
Joined: Wed Sep 12, 2007 4:59 am
Location: Tokyo

Postby freak42 » Tue Nov 24, 2009 9:39 am

You don't necessarily need to create a classes.jar from the svn classes, you can also simply link/include these classes in your eclipse project classpath, that way they also get compiled and included as necessary together with your own java files.

If you need help setting that up, I might be able to help you, however I am not at home right now and cannot peek into my eclipse

hth

Matthias
freak42
New User
 
Posts: 2
Joined: Thu Oct 29, 2009 11:47 pm

Re: Compiling the latest version of classes.jar

Postby Eric » Tue Nov 24, 2009 6:01 pm

Shawn wrote:
Eric wrote:Unfortunately, the LeJOS plugin's "upload to brick" menu item gives me the helpful warning in the console that "something went wrong [...]". Any ideas why this might be?


Hi,

Did it work before trying the updated classes.jar?

Yup, worked fine

What OS?
Windows XP
How are you trying to upload? USB? bluetooth?
USB
Is there anymore info available on the error?
Unfortunately not. That's what really sucks.
What version of java are you using (32 or 64 bit)?
Not sure. Probably 32 bit.

Eric
Last edited by Eric on Tue Nov 24, 2009 6:25 pm, edited 1 time in total.
User avatar
Eric
Novice
 
Posts: 63
Joined: Sat Oct 24, 2009 5:07 pm
Location: UK

Postby gloomyandy » Tue Nov 24, 2009 6:16 pm

Hi,
So what exactly did you do when you say that you downloaded a post 0.85 and built the classes.jar? Did you download any of the other sources? Did you build any of them? Did you move the built file to anyplace? What happens if you put the original files back (you did keep a copy right?).

Andy

PS In general you can't just download and use the latest class files with an older release. They may often contain changes that require new a new linker and perhaps new firmware. If you simply want the latest version of things you are probably better off using the pre-built files in the developer snapshot (they will usually work together).
User avatar
gloomyandy
leJOS Team Member
 
Posts: 4077
Joined: Fri Sep 28, 2007 2:06 pm
Location: UK

Postby Eric » Tue Nov 24, 2009 6:27 pm

I just unzipped the entire GNU Tarball link and put them where the old files were (yes, I backed them up!). I then right-clicked on the ant build file and clicked Run as -> Ant Buildfile. The classes.jar file was successfully built (I think), so I assume that wasn't the problem.

Developer snapshot?
User avatar
Eric
Novice
 
Posts: 63
Joined: Sat Oct 24, 2009 5:07 pm
Location: UK

Postby gloomyandy » Tue Nov 24, 2009 7:26 pm

Hi Eric,
Sorry I still don't understand what you did...

What tarball did you use? What part of svn did you download it from?
What files did you overwrite? Just the classes sources or did the tarball contain all of the leJOS source files?
What build file did you right click on?

Also you didn't say what else you have done. The build process will probably only build the classes.jar in the source/build directory. Did you copy classes.jar to any other place? Have you tried putting things back? What happens then? Also when you try to build your project does it compile ok, does it link ok? I think there should be separate options to compile, link and upload. Oh and what about using the command line tools can you use them to build a sample project and run it?

It may be that the best thing to do is to re-install the 0.85 release and get that working again. Then we can help you do whatever it is that you wanted to do with a newer build. As I said you can't normally just uses a newer set of classes you need other parts as well...

Andy
User avatar
gloomyandy
leJOS Team Member
 
Posts: 4077
Joined: Fri Sep 28, 2007 2:06 pm
Location: UK

Postby Eric » Tue Nov 24, 2009 7:35 pm

Sorry for being unclear. I just got the "classes" project from the svn. I then backed up the existing classes folder, and replaced the original files with the one in the tarball. I then opened eclipse and build the classes project using the ant build file. IIRC, there was only one build file (build.xml).

I then deleted the classes.jar from the project in question (already LeJOS-ified), and replaced it with the one generated by the classes project. Right clicking and uploading caused the unhelpful message to appear in the console. I can only assume that it didn't compile, as the linking progressbar never appeared.

What I'm looking for is some better color sensor functionality. I noticed that ColorLightSensor has been replaced by ColorSensor. I tried just copying one file, but there were too many dependancies within the classes project, so I gave up and got the whole thing.

What is the correct way of getting a newer, unreleased version (if it's possible and doesn't violate a licence)?
User avatar
Eric
Novice
 
Posts: 63
Joined: Sat Oct 24, 2009 5:07 pm
Location: UK

Postby gloomyandy » Tue Nov 24, 2009 8:33 pm

Hi,
Th easy way to get support for the ColorSensor is to use this classes.jar
http://dl.getdropbox.com/u/264450/Work/classes.jar
This was built by another user and is 0.85 with the required fixes.

There have been lots of changes since we made 0.85 so trying to use the latest sources is probably not going to work.


If you really want to use the latest build then here are the details. But you may not get much help with trying to sort out any problems...

To use the latest developers snapshot you need to download the snapshot dir from svn. Then follow the following instructions:

NOTE: If you follow the steps below it will delete any programs you have on your nxt.

Once you have it downloaded you need to do the following...
1. Go to the directory that contains your current lejos install. This is probably in the "Program files" dir and is called "leJOS NXJ"
2. Rename that directory to be <name>.rel where <name> was the original name of the directory.
3. Unzip the snapshot file this should contain a directory called snapshot. Copy this dir into the directory that contains your release leJOS dir (i.e. "Program files").
4. Rename the snapshot to be <name> the original name of your release dir.
4a. If you have an nxj.properties file in your <name>.rel\bin dir copy this over to the new <name>\bin dir.
5. Turn on your nxt and attach it via USB.
6. go to a cmd window and run nxjflash -v -f. This will download the new firmware and reformat the nxt. It will also verify the download (so may take a little while).
7. In the version menu it should show a new build number for the firmware.
8. Test downloading to the nxt and let me know how you get on.

Notes:
1. You can switch back to the old release by renaming the current <name> to <name>.new and <name>.rel to <name>
2. I'm not sure if this build will work with the Eclipse plugin, so please use the command line tools to test with (at least at first).
3. Some of the APIs may have changed so you may get errors with existing code...
4. This contains all of the files required to run leJOS from the command line. Note that there are other versions of some files like classes.jar in the source files installed in your home dir. The installed ant files will use this version of classes.jar by default so you either need to replace this copy of classes.jar, or modify the ant build files to use the version you have just installed...
5. If you do the above then the sources for leJOS installed in your home directory will not match the installed system. So some of the samples will not work etc. If this is a problem for you then you may need to switch to a developer environment...

As you can see the process is relatively complex and you may end up with APIs that have bugs in them, so be prepared to go back to a release build if you run into a problem...

Good luck

Andy
User avatar
gloomyandy
leJOS Team Member
 
Posts: 4077
Joined: Fri Sep 28, 2007 2:06 pm
Location: UK

Postby freak42 » Tue Nov 24, 2009 10:48 pm

ok, here's the way I did it in Eclipse.
However be advised that I am quite new to leJos and do not know whether this way is endorsed or not.

Anyhow:
- right click on your project folder in the package view in eclipse and click properties (assuming this is a new vanilla java project)

- then choose "java build path" on the left and the "source" tab on top, click the "Link Source.." button on the right side, then choose (browse button) the ../trunk/classes folder within your svn lejos checkout folder - click finish.

- switch to the libraries tab on top and "add external jars" , add the following jars within your svn lejos checkout folder :
./snapshot/lib/pctools.jar
./snapshot/lib/jtools.jar
./snapshot/lib/pccomm.jar

(I am not sure if the above jars are always correct or if you should build them yourself (or link the source), however this is currently working fine here)
freak42
New User
 
Posts: 2
Joined: Thu Oct 29, 2009 11:47 pm

Postby gloomyandy » Tue Nov 24, 2009 11:18 pm

Hi,
I've reposted this because for some reason the previous version is not showing up...

The easy way to get support for the ColorSensor is to use this classes.jar
http://dl.getdropbox.com/u/264450/Work/classes.jar
This was built by another user and is 0.85 with the required fixes.

There have been lots of changes since we made 0.85 so trying to use the latest sources is probably not going to work.


If you really want to use the latest build then here are the details. But you may not get much help with trying to sort out any problems...

To use the latest developers snapshot you need to download the snapshot dir from svn. Then follow the following instructions:

NOTE: If you follow the steps below it will delete any programs you have on your nxt.

Once you have it downloaded you need to do the following...
1. Go to the directory that contains your current lejos install. This is probably in the "Program files" dir and is called "leJOS NXJ"
2. Rename that directory to be <name>.rel where <name> was the original name of the directory.
3. Unzip the snapshot file this should contain a directory called snapshot. Copy this dir into the directory that contains your release leJOS dir (i.e. "Program files").
4. Rename the snapshot to be <name> the original name of your release dir.
4a. If you have an nxj.properties file in your <name>.rel\bin dir copy this over to the new <name>\bin dir.
5. Turn on your nxt and attach it via USB.
6. go to a cmd window and run nxjflash -v -f. This will download the new firmware and reformat the nxt. It will also verify the download (so may take a little while).
7. In the version menu it should show a new build number for the firmware.
8. Test downloading to the nxt and let me know how you get on.

Notes:
1. You can switch back to the old release by renaming the current <name> to <name>.new and <name>.rel to <name>
2. I'm not sure if this build will work with the Eclipse plugin, so please use the command line tools to test with (at least at first).
3. Some of the APIs may have changed so you may get errors with existing code...
4. This contains all of the files required to run leJOS from the command line. Note that there are other versions of some files like classes.jar in the source files installed in your home dir. The installed ant files will use this version of classes.jar by default so you either need to replace this copy of classes.jar, or modify the ant build files to use the version you have just installed...
5. If you do the above then the sources for leJOS installed in your home directory will not match the installed system. So some of the samples will not work etc. If this is a problem for you then you may need to switch to a developer environment...

As you can see the process is relatively complex and you may end up with APIs that have bugs in them, so be prepared to go back to a release build if you run into a problem...

Good luck

Andy
User avatar
gloomyandy
leJOS Team Member
 
Posts: 4077
Joined: Fri Sep 28, 2007 2:06 pm
Location: UK

Postby Eric » Sun Nov 29, 2009 1:20 pm

gloomyandy wrote:Hi,
I've reposted this because for some reason the previous version is not showing up...

The easy way to get support for the ColorSensor is to use this classes.jar
http://dl.getdropbox.com/u/264450/Work/classes.jar
This was built by another user and is 0.85 with the required fixes.

There have been lots of changes since we made 0.85 so trying to use the latest sources is probably not going to work.


If you really want to use the latest build then here are the details. But you may not get much help with trying to sort out any problems...

To use the latest developers snapshot you need to download the snapshot dir from svn. Then follow the following instructions:

NOTE: If you follow the steps below it will delete any programs you have on your nxt.

Once you have it downloaded you need to do the following...
1. Go to the directory that contains your current lejos install. This is probably in the "Program files" dir and is called "leJOS NXJ"
2. Rename that directory to be <name>.rel where <name> was the original name of the directory.
3. Unzip the snapshot file this should contain a directory called snapshot. Copy this dir into the directory that contains your release leJOS dir (i.e. "Program files").
4. Rename the snapshot to be <name> the original name of your release dir.
4a. If you have an nxj.properties file in your <name>.rel\bin dir copy this over to the new <name>\bin dir.
5. Turn on your nxt and attach it via USB.
6. go to a cmd window and run nxjflash -v -f. This will download the new firmware and reformat the nxt. It will also verify the download (so may take a little while).
7. In the version menu it should show a new build number for the firmware.
8. Test downloading to the nxt and let me know how you get on.

Notes:
1. You can switch back to the old release by renaming the current <name> to <name>.new and <name>.rel to <name>
2. I'm not sure if this build will work with the Eclipse plugin, so please use the command line tools to test with (at least at first).
3. Some of the APIs may have changed so you may get errors with existing code...
4. This contains all of the files required to run leJOS from the command line. Note that there are other versions of some files like classes.jar in the source files installed in your home dir. The installed ant files will use this version of classes.jar by default so you either need to replace this copy of classes.jar, or modify the ant build files to use the version you have just installed...
5. If you do the above then the sources for leJOS installed in your home directory will not match the installed system. So some of the samples will not work etc. If this is a problem for you then you may need to switch to a developer environment...

As you can see the process is relatively complex and you may end up with APIs that have bugs in them, so be prepared to go back to a release build if you run into a problem...

Good luck

Andy


Thanks, the developer snapshot did the trick. The command line works as expected. Unfortunately, the Eclipse plugin still fails to work. Any suggestion on how to fix this?
User avatar
Eric
Novice
 
Posts: 63
Joined: Sat Oct 24, 2009 5:07 pm
Location: UK

Postby gloomyandy » Sun Nov 29, 2009 2:54 pm

Hi,
Sorry I don't use Eclipse so can't really help with this very much. Perhaps one of the other developers may be able to help. There are other copies of the various system jar files that may need to be updated. You may want to search from your home dir for *.jar and replace any of the files that match the ones in the leJOS lib directory (so classes.jar, jtools.jar etc) with the version from the snapshot. If you do this note that the sources in your home dir will no longer match the built files...

If you are still having problems with Eclipse then post the details here and you may get some help...

Andy
User avatar
gloomyandy
leJOS Team Member
 
Posts: 4077
Joined: Fri Sep 28, 2007 2:06 pm
Location: UK


Return to NXJ Software

Who is online

Users browsing this forum: No registered users and 1 guest

more stuff