Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » Java and remote jars
Java and remote jars [message #1063238] Wed, 12 June 2013 19:10 Go to next message
Simon Platten is currently offline Simon PlattenFriend
Messages: 4
Registered: June 2013
Location: United Kingdom
Junior Member
Hello,

Apologies if this is in the wrong location, I hope a moderator will move it to the appropriate location.

I am using Eclipse Juno for a project on a beaglebone Black. I have java installed on the beaglebone and Juno running on my development system.

So far I've gotten a simple java application running on the remote host and can single step using eclipse Juno from my development system.

Now I want to connect to the mysql server which is running on the beaglebone Black. I have downloaded JDBC for mysql and installed the jar in /usr/local/

I have exported the path to CLASSPATH, but I don't know how I tell eclipse where to find the jar file, what I mean is I can't see how to add a path to the remote location on the target file system.

I've tried using a local reference on my development system, but so far all attempts have failed and when I try to run the application I get an exception:

java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:186)
at cantley.co.uk.clsDB.<init>(clsDB.java:62)
at cantley.co.uk.clsMain.main(clsMain.java:24)


Is what I'm trying to do possible, can anyone help?

Thank you,


Kind Regards,
Sy
Re: Java and remote jars [message #1063246 is a reply to message #1063238] Wed, 12 June 2013 20:10 Go to previous messageGo to next message
Nitin Dahyabhai is currently offline Nitin DahyabhaiFriend
Messages: 4434
Registered: July 2009
Senior Member

The system CLASSPATH is not used, otherwise you could only work on one thing at a time and working on something different would require reconfiguring your system. You should peruse the Java development user guide at http://help.eclipse.org/juno/topic/org.eclipse.jdt.doc.user/gettingStarted/intro/overview.htm .

_
Nitin Dahyabhai
Eclipse Web Tools Platform
Re: Java and remote jars [message #1063247 is a reply to message #1063238] Wed, 12 June 2013 20:10 Go to previous messageGo to next message
Russell Bateman is currently offline Russell BatemanFriend
Messages: 3798
Registered: July 2009
Location: Provo, Utah, USA
Senior Member

On 6/12/2013 1:18 PM, Simon Platten wrote:
> Hello,
>
> Apologies if this is in the wrong location, I hope a moderator will move
> it to the appropriate location.
>
> I am using Eclipse Juno for a project on a beaglebone Black. I have
> java installed on the beaglebone and Juno running on my development system.
> So far I've gotten a simple java application running on the remote host
> and can single step using eclipse Juno from my development system.
>
> Now I want to connect to the mysql server which is running on the
> beaglebone Black. I have downloaded JDBC for mysql and installed the
> jar in /usr/local/
>
> I have exported the path to CLASSPATH, but I don't know how I tell
> eclipse where to find the jar file, what I mean is I can't see how to
> add a path to the remote location on the target file system.
>
> I've tried using a local reference on my development system, but so far
> all attempts have failed and when I try to run the application I get an
> exception:
>
> java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
> at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
> at java.security.AccessController.doPrivileged(Native Method)
> at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
> at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
> at java.lang.Class.forName0(Native Method)
> at java.lang.Class.forName(Class.java:186)
> at cantley.co.uk.clsDB.<init>(clsDB.java:62)
> at cantley.co.uk.clsMain.main(clsMain.java:24)
>
>
> Is what I'm trying to do possible, can anyone help?
>
> Thank you,

If I've understood what you're doing, I would ask...

If you can single-step through the remote application, doesn't that mean
you've got the source project for the application locally in Eclipse?

Shouldn't you then have added the MySQL connector to your application's
project in Eclipse, rebuilt the application, redeployed and restarted it
on the remote system?

I admit there are probably ways of using Eclipse for remote debugging
that I'm unaware of and haven't tried. I also confess that I haven't
thought too much through what it means to consume Beaglebone Black in
terms of the development you're doing.
Re: Java and remote jars [message #1063248 is a reply to message #1063247] Wed, 12 June 2013 20:20 Go to previous messageGo to next message
Simon Platten is currently offline Simon PlattenFriend
Messages: 4
Registered: June 2013
Location: United Kingdom
Junior Member
I've only just started using the "Remote System Explorer" tools, these enable you to connect to the remote file system via ssh.

Everything is stored on the remote file system and the tree in eclipse mimics the remote file structure.

I'm not sure what you mean by a mySQL connector in eclipse, but I will look into it. In the past I have written classes that use the JDBC class to connect to the database.

Thank you,


Kind Regards,
Sy
Re: Java and remote jars [message #1063252 is a reply to message #1063248] Wed, 12 June 2013 20:25 Go to previous messageGo to next message
Russell Bateman is currently offline Russell BatemanFriend
Messages: 3798
Registered: July 2009
Location: Provo, Utah, USA
Senior Member

On 6/12/2013 2:20 PM, Simon Platten wrote:
> [snip]
>
> I'm not sure what you mean by a mySQL connector in eclipse, but I will
> look into it. In the past I have written classes that use the JDBC
> class to connect to the database.
>
> Thank you,


Sorry. By "MySQL connector", I meant what you're calling "JDBC for
mysql". The last time I wrote Java code to MySQL, the JAR from MySQL
actually had "connector" in the name.
Re: Java and remote jars [message #1063255 is a reply to message #1063252] Wed, 12 June 2013 20:36 Go to previous messageGo to next message
Simon Platten is currently offline Simon PlattenFriend
Messages: 4
Registered: June 2013
Location: United Kingdom
Junior Member
Ok, I'm installing the database additions to eclipse to see what options that adds.

So far everything I've tried has failed and it doesn't find the class even if its in the project folder.

Also, building this way I can see no way of exporting or creating a 'jar' file on the target.


Kind Regards,
Sy
Re: Java and remote jars [message #1063264 is a reply to message #1063255] Wed, 12 June 2013 20:55 Go to previous messageGo to next message
Russell Bateman is currently offline Russell BatemanFriend
Messages: 3798
Registered: July 2009
Location: Provo, Utah, USA
Senior Member

On 6/12/2013 2:36 PM, Simon Platten wrote:
> Ok, I'm installing the database additions to eclipse to see what options
> that adds.
>
> So far everything I've tried has failed and it doesn't find the class
> even if its in the project folder.
>
> Also, building this way I can see no way of exporting or creating a
> 'jar' file on the target.

What Nitin says is relevant. I'm making assumptions about how much you
know about developing in Java under Eclipse, etc.

You do realize that you need to "tie" a JAR to a project in Eclipse by
right-clicking on the project, choosing Build Path -> Configure Build
Path -> Libraries (tab) and adding it to the project? This puts it into
the Java CLASSPATH--not to be confused with your Unix/Linux CLASSPATH
environment variable. When you generate the JAR that is your
application, you can choose to include the dependency (MySQL JAR) for
deploying it.

In the end, your remote application has access to that JAR and, in your
local hands, Eclipse has access to its copy. If they're different
versions, you could be unhappy with the result (but that's not our
problem here).
Re: Java and remote jars [message #1063389 is a reply to message #1063264] Thu, 13 June 2013 05:08 Go to previous messageGo to next message
Simon Platten is currently offline Simon PlattenFriend
Messages: 4
Registered: June 2013
Location: United Kingdom
Junior Member
Hello,

Yes I do realise that, but the question is, when deveoping on a remote target, where the file system layout is different to the local host, how do you add jar's and libs that are on the remote host?

There doesn't seem to be a way of doing this. It seems like main project files reside on the remote target, but the jar's and lib's can only be selected from the development system. Which I think is the problem.

Last night I created a completely local project, exported to a Jar then uploaded the Jar to the target and tested, that worked find and did not complain about missing classes.

I can only think that it is something I've missed in creating the remote project.

I have done lots of Java development using eclipse, this is the first time I've tried to use the remote system development tools.

Back in the remote project I cannot see how to export the jar file, it only allows you to export to the local file system.

Hope this makes sense?



Kind Regards,
Sy
Re: Java and remote jars [message #1063617 is a reply to message #1063389] Thu, 13 June 2013 14:06 Go to previous message
Russell Bateman is currently offline Russell BatemanFriend
Messages: 3798
Registered: July 2009
Location: Provo, Utah, USA
Senior Member

On 6/12/2013 11:08 PM, Simon Platten wrote:
> Hello,
>
> Yes I do realise that, but the question is, when deveoping on a remote
> target, where the file system layout is different to the local host, how
> do you add jar's and libs that are on the remote host?
>
> There doesn't seem to be a way of doing this. It seems like main
> project files reside on the remote target, but the jar's and lib's can
> only be selected from the development system. Which I think is the
> problem.
>
> Last night I created a completely local project, exported to a Jar then
> uploaded the Jar to the target and tested, that worked find and did not
> complain about missing classes.
>
> I can only think that it is something I've missed in creating the remote
> project.
>
> I have done lots of Java development using eclipse, this is the first
> time I've tried to use the remote system development tools.
> Back in the remote project I cannot see how to export the jar file, it
> only allows you to export to the local file system.
>
> Hope this makes sense?

It does. I do mostly JEE (web programming) these days and on rare
occasion what you're doing. I remember the first time I did some remote
debugging on an application, so I remember your bewilderment. I would
just make my application JAR as stand-alone as possible with respect to
what JARs it uses in order to minimize or eliminate the "different"
filesystem layout issue.

There's not really a better forum to direct you to. You might ask on
javaranch.com and/or stackoverflow.com if no bright crayons answer here.
As the weekend approaches, the likelihood of a bright crayon grows dim.
Ask elsewhere now if you're in a hurry.

Best of luck.
Previous Topic:Eclipse crashing with class not found in an odd package name
Next Topic:build and deploy
Goto Forum:
  


Current Time: Fri Apr 19 22:59:32 GMT 2024

Powered by FUDForum. Page generated in 0.09161 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top