1 of 2
1
MTApplication class is missing when app is deployed
Posted: 25 May 2012 07:45 AM   [ Ignore ]
Avatar
Rank
Joined  2012-04-15
Total Posts:  38
New Member

Hi there,

I’m having a problem when deploying my application. I’m using the command

java -jar -XX:-HeapDumpOnOutOfMemoryError build.jar

But I’m said:

Captura.png

I can’t understand it, because Eclipse perfectly recognizes and finds org.mt4j.MTApplication class, and I can run the project inside Eclipse.

I think the exception is thrown here:

private final class InnerMTApplication extends MTApplication {

But I don’t really know what’s being missed in the deployment.

Anyone knows?

Thanks.

Profile
 
 
Posted: 27 May 2012 10:54 PM   [ Ignore ]   [ # 1 ]
Avatar
Rank
Joined  2012-03-29
Total Posts:  59
New Member

Is the main class declared in the mainfest file with his complete path?

Profile
 
 
Posted: 28 May 2012 04:13 AM   [ Ignore ]   [ # 2 ]
Avatar
Rank
Joined  2012-04-15
Total Posts:  38
New Member

I think it is, this is the MANIFEST.MF file:

Manifest-Version1.0
Sealed
true
Main
-Class: tableApp.mt4j.MainClass

It was generated by Eclipse when deploying.

This is the structure of my project, which shows that the Main-Class line of the manifest file is right:

Capture-2.png

...

Profile
 
 
Posted: 28 May 2012 11:52 AM   [ Ignore ]   [ # 3 ]
Avatar
Rank
Joined  2012-03-29
Total Posts:  59
New Member

I saw the error, i think this is because the lib files aren’t in the class path, one solution could be put the mt4j core and desktop in the same folder, or adding them to the java classpath, or adding them to the mainfest file, because the error is searching the MTApplication class.
If you want to put in the mainfest file is something like (just the last line, where the lib files are marked)
Manifest-Version: 1.0
Ant-Version: Apache Ant 1.7.0
Created-By: 1.6.0_02-b06 (Sun Microsystems Inc.)
Main-Class: marot.francois.MyMainClass
Product-Name:  myApp
Package-Title: marot.francois
Package-Version: 1.00.00
Package-Vendor: Elsys Design Avisto
Class-Path: myCustomLibPath2/ant-launcher.jar myCustomLibPath2/ant.jar myCustomLibPath3/scdata.jar myCustomLibPath1/sctm.jar

Profile
 
 
Posted: 28 May 2012 02:02 PM   [ Ignore ]   [ # 4 ]
Avatar
Rank
Joined  2012-04-15
Total Posts:  38
New Member

I don’t get to understand that 100%. All the referenced libraries are already in the build path (if I hover the build path option for any of them, I’m just able to remove them from the build path, so they should be already inside there, isn’t it?

Profile
 
 
Posted: 28 May 2012 02:17 PM   [ Ignore ]   [ # 5 ]
Avatar
Rank
Joined  2012-03-29
Total Posts:  59
New Member

But are you reffering to eclipse? because like netbeans creates a lib folder and stuff, but i don’t know why they don’t include in the mainfest, so when you run from eclipse, eclipse adds dinamicly the refferences, but if you try to use the jar of the distribution everything gets fucked up, for example, if you add images directly in the project folder, you’ll can work with them nice inside eclipse, but if you try to open the jar directly the images will not being found, until you put the images in the same folder of the jar, not the project, so the same happends with libraries, just make a try puttiing the mt4j jars in the same forlder of your jar, if the problem is solved then you know why, if not, let us know and we can check what else are wrong
PD: Sorry for my bad english, i’m good understanding it, but not writing it, hope you can understand me

Profile
 
 
Posted: 28 May 2012 02:30 PM   [ Ignore ]   [ # 6 ]
Avatar
Rank
Joined  2012-04-15
Total Posts:  38
New Member

Your english is more than enough, no worries. And yeah, I’m working with Eclipse, and I must say that it’s my first serious project on it, and I’ve already had to ask for help on their forums because of IDE matters. I’m gonna try that of copying all the libs to the same folder, although they’re like a swarm of libs… I’ll check if that works and post something.

Profile
 
 
Posted: 28 May 2012 02:44 PM   [ Ignore ]   [ # 7 ]
Avatar
Rank
Joined  2012-04-15
Total Posts:  38
New Member

Not, it’s not working neither. I’ve tried to copy first the directories that were inside the workspace, but it still lacks the same class, and then, I’ve tried to copy the core.jar and mt4j.jar, which are the files where I guess the org.mt4j.MTApplication class may be included in (if it is included in another one please let me know in which one), but still the same result.

Profile
 
 
Posted: 28 May 2012 02:50 PM   [ Ignore ]   [ # 8 ]
Avatar
Rank
Joined  2012-03-29
Total Posts:  59
New Member

Ill start working so ill can check until night, but if you still with the problem ill check it, if the error its the same let me check how to make eclipse to include the libs, because the error is finding the mt4j jars, i think the mtapp is in mt core, but i don’t remember well, anyway, or its in core, or its in desktop, but in the night with more time i’ll hope can help you a little more with more time

Profile
 
 
Posted: 28 May 2012 03:21 PM   [ Ignore ]   [ # 9 ]
Avatar
Rank
Joined  2012-04-15
Total Posts:  38
New Member

Wait I’ve just found a plug-in for Eclipse which is said to do exactly what I need:

“The Fat Jar Eclipse Plug-In is a Deployment-Tool which deploys an Eclipse java-project into one executable jar.”

http://fjep.sourceforge.net/

I gotta go to bed now (spanish time, tomorrow got to wake up early), but I’ll give it a try as soon as possible.

EDIT: Yeah, it worked so perfectly. I strongly recommend that plug-in to Eclipse users, specially noobs as me.

Profile
 
 
Posted: 29 May 2012 04:50 AM   [ Ignore ]   [ # 10 ]
Avatar
Rank
Joined  2012-04-15
Total Posts:  38
New Member

mm..actually, I have just realized it is not working 100% properly. Since I have to run it in a non-touch screen because it has more RAM, I’ve followed the section 6 of the FAQ to enable multi mice input. I’ve modified the classpath so it includes ALL files, and it now looks like this:

mt4jLibs/*.jar mt4jLibs/batik/*.jar mt4jLibs/whirlylib/*.jar processingLibs/*.jar mt4jLibs/jogl/*.jar mt4jLibs/tuio/*.jar mt4jLibs/gsvideo/*.jar ./*.dll ./*.txt ./*.jnilib ./*.so ./*.xml

But anyway, when trying to run the deployed .jar file, I get this:

Capture-4.png

Which is provoked, I guess, because the Settings.txt file isn’t loaded. But why not?

Profile
 
 
Posted: 29 May 2012 07:24 AM   [ Ignore ]   [ # 11 ]
Avatar
RankRankRankRank
Joined  2008-04-30
Total Posts:  612
Elite

Did you export your build.jar as a “runnable jar file” ? If not you have to reference all jar files and classes used by your application.
See also the answer of this stackoverflow question: http://stackoverflow.com/questions/1914493/add-jar-file-to-buildpath-in-windows-command-line

I recommend to export your app as a runnable jar file and try again if you havent already (havent read every post in the thread)

 Signature 

MT4j - Multi-Touch for Java!

Profile
 
 
Posted: 29 May 2012 09:53 AM   [ Ignore ]   [ # 12 ]
Avatar
Rank
Joined  2012-04-15
Total Posts:  38
New Member

Although that was not the problem, the link gave me an idea. I thought that maybe the file ‘Settings.txt’ was fetched in the same directory than the one where the build.jar file is placed, which would explain why, although the .jar itself contains the file, inside the ‘lib’ folder, the app isn’t able to find it. Exactly, that was the problem. Is there anyway to make mt4j look for the required files inside the file itself, like with Toolkit.getDefaultToolkit().getResource(..), for example?

Profile
 
 
Posted: 29 May 2012 11:48 AM   [ Ignore ]   [ # 13 ]
Avatar
Rank
Joined  2012-03-29
Total Posts:  59
New Member

Don’t are you missing the dlls?, because java can take the jars, but i think a little more instructions are nedeed to include the dlls

Profile
 
 
Posted: 29 May 2012 11:57 AM   [ Ignore ]   [ # 14 ]
Avatar
Rank
Joined  2012-04-15
Total Posts:  38
New Member

I added them in the manifest. It now looks like this:

Manifest-Version: 1.0
Sealed: true
Main-Class: tableApp.mt4j.MainClass
Class-Path: mt4jLibs/*.jar mt4jLibs/batik/*.jar mt4jLibs/whirlylib/*.jar processingLibs/*.jar mt4jLibs/jogl/*.jar mt4jLibs/tuio/*.jar mt4jLibs/gsvideo/*.jar

And the rest of the files, including the Settings.txt, are placed in the same directory than the application, so these problems are solved.

Profile
 
 
Posted: 29 May 2012 12:00 PM   [ Ignore ]   [ # 15 ]
Avatar
Rank
Joined  2012-03-29
Total Posts:  59
New Member

Nice, good luck with your project

Profile
 
 
   
1 of 2
1