Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » Executable Jar won't load from command line
icon5.gif  Executable Jar won't load from command line [message #890623] Fri, 22 June 2012 17:25 Go to next message
Robert Lockwood is currently offline Robert Lockwood
Messages: 39
Registered: October 2010
Location: Riverside, CA, USA
Member
I am attempting to learn about socket communications by creating the threaded socket server I found on Oracle: http://www.oracle.com/technetwork/java/socket-140484.html

When I run it from Eclipse Indigo on Ubuntu the GUI is displayed and I can telnet a line of text to the GUI.

I exported the class as an executable jar but when I run it from the command line (with or without sudo) I get a loader error that I don't understand at all:


programmer@blue:~/var/jars$ sudo java -jar SocketServer.jar
[sudo] password for programmer:
Exception in thread "main" java.lang.IllegalAccessException: Class org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader can not access a member of class fireScience.airborne.server.SocketThrdServer with modifiers "public static"
at sun.reflect.Reflection.ensureMemberAccess(Reflection.java:95)
at java.lang.reflect.Method.invoke(Method.java:607)
at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58)

FWIW this is my main:
	public static void main(String[] args) {
		SocketThrdServer frame = new SocketThrdServer();
		frame.setTitle("Server Program");
		WindowListener l = new WindowAdapter() {
			public void windowClosing(WindowEvent e) {
				System.exit(0);
			}
		};
		frame.addWindowListener(l);
		frame.pack();
		frame.setLocation(100, 100);
		frame.setVisible(true);
		frame.listenSocket();
	}


Why is the loader complaining and how do I fix the problem?
Re: Executable Jar won't load from command line [message #891741 is a reply to message #890623] Mon, 25 June 2012 17:45 Go to previous message
Robert Lockwood is currently offline Robert Lockwood
Messages: 39
Registered: October 2010
Location: Riverside, CA, USA
Member
I'm convinced that the problem lies in some preference or setting in Eclipse. I have some other Jars that I export with no problem. The manifests are the same but for the class names. (The classes are demo classes from an Oracle tutorial on sockets.)

A few months ago I upgraded Ubuntu to 10.11 an updated Eclipse. Ubuntu installs Open JDK but my first installation of Eclipse used SE. I notice that the build information for the JAR that works has SE in the build but the new packages have Open JDK.

From the command line java -version returns Open JDK.

The two new classes, each in a new project work when launched from Eclipse - but not when they are exported.

I don't know how to set whatever preferences that need to be modified to make this work - what I've tried has not worked.
Previous Topic:Creating XML file from java program
Next Topic:Eclipse proxy implementation, NTML
Goto Forum:
  


Current Time: Tue Sep 30 20:01:37 GMT 2014

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

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