Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 5 of 5

Thread: Compiling program to unix

  1. #1
    Member
    Join Date
    Oct 2013
    Location
    Manila, Philippines
    Posts
    285
    My Mood
    Amused
    Thanks
    6
    Thanked 64 Times in 61 Posts

    Default Compiling program to unix

    Hi everyone. I'm trying to compile a program in UNIX together with jar files.
    There is no problem compiling program with just one jar file like command below
    javac -cp For_UNIX.jar TestJar.java

    But when I try to compile a program together with different jar files, like command below
    javac -cp dom4j-1.6.1.jar poi-ooxml-3.9-20121203.jar xmlbeans-qname.jar poi-ooxml-schemas-3.9-20121203.jar poi-3.9-20121203.jar Size.java
    I always got this error
    javac: invalid flag: poi-ooxml-3.9-20121203.jar
    Usage: javac <options> <source files>
    use -help for a list of possible options


    I already tried different command to compile in UNIX as suggested in stack over flow forum. But it didn't help.
    I hope someone can help me with this problem..

    The second 1 is, how to run the compiled program?
    I have Successfully compiled the TestJar.java as shown on first paragraph of this thread. But I can't execute it.
    Thank you for your help.


  2. #2
    Junior Member
    Join Date
    Feb 2014
    Posts
    3
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default Re: Compiling program to unix

    Try compiling like this:
    Javac -cp $CLASSPATH:.:dom4j-1.6.1.jar:poi-ooxml-3.9-20121203.jarmlbeans-qname.jar:poi-ooxml-schemas-3.9-20121203.jar:poi-3.9-20121203.jar Size.java

    separate libraries with colon( not with space.

  3. The Following User Says Thank You to akstheking For This Useful Post:

    Ganeprog (February 11th, 2014)

  4. #3
    Member
    Join Date
    Oct 2013
    Location
    Manila, Philippines
    Posts
    285
    My Mood
    Amused
    Thanks
    6
    Thanked 64 Times in 61 Posts

    Default Re: Compiling program to unix

    Try compiling like this:
    Javac -cp $CLASSPATH:.:dom4j-1.6.1.jar:poi-ooxml-3.9-20121203.jarmlbeans-qname.jar:poi-ooxml-schemas-3.9-20121203.jar:poi-3.9-20121203.jar Size.java
    Thank you.. It works..
    one last question. how would I run the Size.java? together with the jar files?
    Thank you so much for your time

  5. #4
    Junior Member
    Join Date
    Feb 2014
    Posts
    3
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default Re: Compiling program to unix

    Java -cp $CLASSPATH:.:dom4j-1.6.1.jar:poi-ooxml-3.9-20121203.jarmlbeans-qname.jar:poi-ooxml-schemas-3.9-20121203.jar:poi-3.9-20121203.jar Size

  6. #5
    Member
    Join Date
    Oct 2013
    Location
    Manila, Philippines
    Posts
    285
    My Mood
    Amused
    Thanks
    6
    Thanked 64 Times in 61 Posts

    Default Re: Compiling program to unix

    Thank you sir akstheking
    That really helped!

Similar Threads

  1. GUI Lotto Program Not Compiling
    By FalcomerG in forum What's Wrong With My Code?
    Replies: 3
    Last Post: December 16th, 2013, 02:15 PM
  2. [SOLVED] Program not compiling correctly
    By d0mlnance in forum What's Wrong With My Code?
    Replies: 3
    Last Post: October 1st, 2013, 09:53 AM
  3. Program not compiling + calling methods help
    By alex067 in forum What's Wrong With My Code?
    Replies: 9
    Last Post: September 11th, 2012, 07:41 AM
  4. program not compiling
    By russ in forum What's Wrong With My Code?
    Replies: 1
    Last Post: January 26th, 2012, 12:39 AM
  5. How to get unix timestamp from formatted date?
    By snytkine in forum Java Theory & Questions
    Replies: 5
    Last Post: October 12th, 2010, 08:07 AM