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 from a txt file

  1. #1
    Member
    Join Date
    Oct 2010
    Posts
    31
    Thanks
    2
    Thanked 1 Time in 1 Post

    Default compiling from a txt file

    I use to be able to compile a txt file that had all my source files listed in it like this:

    occupant.java
    goodguy.java
    morphon.java
    ...

    I can't remember what I typed at the console. It was something like javac @ compile.txt (but not that). Does anyone know how this is done? Thanks.


  2. #2
    Super Moderator helloworld922's Avatar
    Join Date
    Jun 2009
    Posts
    2,895
    Thanks
    23
    Thanked 619 Times in 561 Posts
    Blog Entries
    18

    Default Re: compiling from a txt file

    See: javac - Java programming language compiler

    There's a section called Command Line Argument Files and should be what you want (from what I read, you're syntax is very close to being correct, simply remove the space between @ and compile.txt)

  3. #3
    Think of me.... Mr.777's Avatar
    Join Date
    Mar 2011
    Location
    Pakistan
    Posts
    1,136
    My Mood
    Grumpy
    Thanks
    20
    Thanked 82 Times in 78 Posts
    Blog Entries
    1

    Default Re: compiling from a txt file

    You should save .txt as .java and then at command prompt
    javac filename.java
    java filename

  4. #4
    Super Moderator helloworld922's Avatar
    Join Date
    Jun 2009
    Posts
    2,895
    Thanks
    23
    Thanked 619 Times in 561 Posts
    Blog Entries
    18

    Default Re: compiling from a txt file

    Quote Originally Posted by Mr.777 View Post
    You should save .txt as .java and then at command prompt
    javac filename.java
    java filename
    He's looking to create a text-file which has javac compiler settings. This doesn't have to be a .java file (actually, it's a bad idea to name this as a .java file because this doesn't contain any Java source code).

  5. #5
    Member
    Join Date
    Oct 2010
    Posts
    31
    Thanks
    2
    Thanked 1 Time in 1 Post

    Default Re: compiling from a txt file

    Quote Originally Posted by helloworld922 View Post
    See: javac - Java programming language compiler

    There's a section called Command Line Argument Files and should be what you want (from what I read, you're syntax is very close to being correct, simply remove the space between @ and compile.txt)
    Thanks, this worked.

    And sorry for not replying earlier. My computer crashed and I had to reinstall everything.

Similar Threads

  1. Im having problems compiling a very simple .js file to .exe
    By idesyl in forum Member Introductions
    Replies: 3
    Last Post: March 10th, 2011, 05:16 AM
  2. Help with Compiling
    By w.spidey in forum Object Oriented Programming
    Replies: 10
    Last Post: September 9th, 2010, 01:48 PM
  3. compiling a file
    By jkoracle23 in forum Java Theory & Questions
    Replies: 4
    Last Post: June 19th, 2010, 03:20 PM
  4. Declaring variables in constructor and compiling
    By Newoor in forum Object Oriented Programming
    Replies: 3
    Last Post: December 5th, 2009, 01:07 PM
  5. Strange Compiling Error
    By crism85 in forum What's Wrong With My Code?
    Replies: 5
    Last Post: October 13th, 2009, 12:59 AM