Make File for Java/Linux

JAVA - Create a file in linux server

If the machine "10.30.10.117" is on your local network and if you have the permission to create file on that machine then the problem is

File folder = new File("//10.30.10.117:/home/images/784/");
File file = new File("//10.30.10.117:/home/images/784/1508-1-N.png");
folder.mkdirs();
file.createNewFile();

Before write to file create it.

But if the machine "10.30.10.117" is on external network for your machine then you can't create a file or folder directly from your machine. You need ftp connection vb...

How do I create a Makefile that will compile and run java code with command line arguments?


JC = javac
JCR = java

.SUFFIXES: .java .class
.java.class:
$(JC) $*.java

CLASSES = \
MainDriver.java \
FSA.java \
State.java \
Transition.java

TXT_FILES = \
test1.txt \
test2.txt \
test3.txt \

default: classes exec-tests

classes: $(CLASSES:.java=.class)

clean:
$(RM) *.class *~

exec-tests: classes
set -e; \
for file in $(TXT_FILES); do $(JCR) MainDriver $$file; done;


.PHONY: default clean classes exec-tests

java makefile make: Nothing to be done for 'default'

That means your classes already exist (therefor nothing is to be done). If you want to rebuild anyway, do a make clean first. Like,

make clean
make

As for jar'ing your compiled classes, you have no jar target.



Related Topics



Leave a reply



Submit