Results 1 to 11 of 11
  1. #1
    KidAget is offline Member
    Join Date
    Feb 2012
    Posts
    9
    Rep Power
    0

    Default is that a must to develop ant file

    hey,
    Is that a must to develop ant file (explicitly) to all Java project if it is suppose to run in other machine?
    If so how?

  2. #2
    doWhile is offline Moderator
    Join Date
    Jul 2010
    Location
    California
    Posts
    1,641
    Rep Power
    7

    Default Re: is that a must to develop ant file

    What makes you think its a 'must'? Did you try it with and without? What happened?

  3. #3
    KidAget is offline Member
    Join Date
    Feb 2012
    Posts
    9
    Rep Power
    0

    Default Re: is that a must to develop ant file

    I don't really know how to develop an "ant file" explicitly and I have to run my project on another machine.
    That is the point where am thinking to figure out which file should be included to perfectly run my project on another machine.
    can any one tell me what to do?

  4. #4
    KidAget is offline Member
    Join Date
    Feb 2012
    Posts
    9
    Rep Power
    0

    Default Re: is that a must to develop ant file

    am so sorry not to be very clear let me try again.
    I just developed my project using NetBeans in windows machine. then I switched my machine to Ubuntu..
    when I try to run the project from command line....It reports an error saying it couldn't find the main class...
    I can't really figure out why because the project perfectly works from command line in windows machine..
    the point that am currently looking for is====> what should I do to let my project work on another machine. it's like the last step after development
    I have really no idea what to do....

  5. #5
    doWhile is offline Moderator
    Join Date
    Jul 2010
    Location
    California
    Posts
    1,641
    Rep Power
    7

    Default Re: is that a must to develop ant file

    Java is platform independent...package and deploy as a jar, and assuming it does not access native methods should run on other platforms. There are many things that can be going wrong and with the information provided we can only guess. Did you package as a jar? How are you trying to run on either platform?

  6. #6
    KidAget is offline Member
    Join Date
    Feb 2012
    Posts
    9
    Rep Power
    0

    Default Re: is that a must to develop ant file

    What do you mean by "packaging as a jar"? do I need to package "dist" folder and the "lib" folder as a single jar file before I move to other machine?
    as you know the jar file of the project is automatically generated during compilation and I was trying to run the jar file being in the dist folder in both case.

  7. #7
    KidAget is offline Member
    Join Date
    Feb 2012
    Posts
    9
    Rep Power
    0

    Default Re: is that a must to develop ant file

    I think [guess] you are right, I was trying to create the jar file even including Manifest.text unfortunately couldn't succeed.
    which are the files that needs to be included on the jar file? am used some libraries too while developing the project.
    and while I specify the entry point I used both MypackageName.className and path/directories to my class . className [because I'm not sure which one is right] but in both case I got an error reporting could not find or load main class. plz if you know how to do it, tell me the steps to do so!

  8. #8
    pbrockway2 is offline Moderator
    Join Date
    Feb 2009
    Location
    New Zealand
    Posts
    4,565
    Rep Power
    12

    Default Re: is that a must to develop ant file

    First, to add to what doWhile suggested, you say that you "switched" your machine to Ubuntu. If it's a new installation of this OS and/or a new installation of the Java runtime, the first thing I'd do is test that it was configured correctly. More specifically I'd write a "Hello world" app and make sure that it ran correctly from the command line/console of the Ubuntu machine.

    (The guiding principles behind such configuration are (1) *don't* export any CLASSPATH and (2) *do* make sure your intended Java runtime is on the path. Ubuntu is associated with a huge and helpful community providing lots of how-tos and write-ups concerning this. Pick something modern and intelligent sounding.)

    Once you are reasonably convinced your Ubuntu/Java runtime is good you can worry about your application. Deploying (packaging) your application as a jar is the way to go. Oracle's Tutorial has an extensive description of the process in the Packaging Programs in JAR Files chapter. I won't try and hide the fact that the detail and precision presented there can come as a rude awakening for some whose experience is limited to an IDE like NB. Nonetheless the first two sections (Using Jar Files and Working with Manifest Files) provide background that is vital to understanding the options provided by IDEs.

  9. #9
    KidAget is offline Member
    Join Date
    Feb 2012
    Posts
    9
    Rep Power
    0

    Default Re: is that a must to develop ant file

    hey guys
    Thanks it works perfectly on both machines after having the jar file. [having the latest version of jdk in both machine]
    but I face another problem.....when I try to run the project on the machine with java version 1.4.2 it reports an error the one i past it below.....what can I do to solve this problem?


    jarfileName.Main (unrecognized class file version)
    at java.lang.VMClassLoader.defineClass(libgcj.so.7rh)
    at java.lang.ClassLoader.defineClass(libgcj.so.7rh)
    at java.security.SecureClassLoader.defineClass(libgcj .so.7rh)
    at java.net.URLClassLoader.findClass(libgcj.so.7rh)
    at java.lang.ClassLoader.loadClass(libgcj.so.7rh)
    at java.lang.ClassLoader.loadClass(libgcj.so.7rh)
    at gnu.java.lang.MainThread.run(libgcj.so.7rh)

  10. #10
    doWhile is offline Moderator
    Join Date
    Jul 2010
    Location
    California
    Posts
    1,641
    Rep Power
    7

    Default Re: is that a must to develop ant file

    If you are compiling the source with a later version of java, unless you set a minor version flag during compilation you cannot run the code with earlier versions of java. Google the exception and you will find lots of information, and take a look at the javac command line arguments which has arguments you can use to set the minor version (I believe it is the target argument)

  11. #11
    KidAget is offline Member
    Join Date
    Feb 2012
    Posts
    9
    Rep Power
    0

    Default Re: is that a must to develop ant file

    I have been searching but did not get any reasonable result...and the saddest thing is I do not have permission to modify the version.
    do you mean i need to re-compile it? why for?

Similar Threads

  1. How to Develop a Website in java
    By rjagan in forum New To Java
    Replies: 7
    Last Post: 09-30-2011, 03:45 PM
  2. Java GUI Develop,emt
    By joaquin386 in forum New To Java
    Replies: 4
    Last Post: 04-24-2010, 03:04 PM
  3. develop mock ups
    By karthikeyan_raju in forum NetBeans
    Replies: 0
    Last Post: 10-19-2009, 04:58 PM
  4. how to develop setup file for java swinggui
    By santhosh_el in forum AWT / Swing
    Replies: 1
    Last Post: 03-24-2009, 10:22 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •