Results 1 to 4 of 4

Thread: Java Makefile

  1. #1
    Elidor is offline Member
    Join Date
    May 2013
    Posts
    6
    Rep Power
    0

    Default Java Makefile

    Hello, I'm trying to use a makefile to run test clients for classes in a package by separating each class in the package to a folder. Doing this I can invoke a makefile in each folder with cmd that will compile the source then run the source by cding back a folder, invoking java and qualifying the name in the root directory of the package. Why do I keep getting this output:
    Java Code:
    cd .. && echo %CD%
    C:\Users\Alex\Desktop\GUI\start
    for this input makefile when running make run:
    Java Code:
    HelloWorldSwing.class : HelloWorldSwing.java
    						javac HelloWorldSwing.java
    
    run :
    		cd .. && echo %CD%
    		
    clean : 
    		del *.class

  2. #2
    jim829 is offline Senior Member
    Join Date
    Jan 2013
    Location
    Northern Virginia, United States
    Posts
    3,544
    Rep Power
    5

    Default Re: Java Makefile

    Well, this is probably not the proper forum to discuss makefile syntax and I haven't used Make in many years. But I suspect it is simply echoing the command and then executing the command. So you must be in a subdirectory under start. It executes cd .. to move to the next directory up and then echos the current directory name. But this is an educated guess.

    Regards,
    Jim
    The Java™ Tutorial | SSCCE | Java Naming Conventions
    Poor planning our your part does not constitute an emergency on my part.

  3. #3
    Elidor is offline Member
    Join Date
    May 2013
    Posts
    6
    Rep Power
    0

    Default Re: Java Makefile

    Quote Originally Posted by jim829 View Post
    Well, this is probably not the proper forum to discuss makefile syntax and I haven't used Make in many years. But I suspect it is simply echoing the command and then executing the command. So you must be in a subdirectory under start. It executes cd .. to move to the next directory up and then echos the current directory name. But this is an educated guess.

    Regards,
    Jim
    Thank you for the response. I just realize as I was responding to this message that in order to invoke subdirectories with the java command I must use . instead of \. In this case I was using java start\HelloWorldSwing.jva instead of java start.HelloWorldSwing. Sorry for such an pointless question.
    Last edited by Elidor; 06-20-2013 at 04:16 AM.

  4. #4
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    3,914
    Rep Power
    5

    Default Re: Java Makefile

    Don't use Make, use ANT or better yet - Maven. Make was not designed to be used with Java; ANT and Maven are. Your life just becomes so much easier and better documented then.

Similar Threads

  1. Replies: 3
    Last Post: 03-16-2012, 10:47 AM
  2. creating a Makefile
    By Fruz in forum New To Java
    Replies: 7
    Last Post: 01-18-2012, 07:12 PM
  3. Help with Linux Makefile
    By ruerric in forum New To Java
    Replies: 36
    Last Post: 07-23-2010, 03:46 AM
  4. MakeFile
    By divyanshu023 in forum New To Java
    Replies: 1
    Last Post: 09-18-2009, 08:16 AM
  5. Help regarding makefile problem
    By rams in forum Networking
    Replies: 0
    Last Post: 11-17-2008, 03:39 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
  •