writing files to a server

So, I'm trying to compile the following code on a linux server, and i'm finding its a different world from compiling on my PC. Anyway, I'm using the GCJ command and I'm getting errors like this:

error: Can't find constructor `java.io.PrintWriter(Ljava/lang/String;)' in type `java.io.PrintWriter'.

PrintWriter outFile =new PrintWriter("home//runblip//public_html//gearscope//java//test.txt");

^

1 error

and here is my code:

import java.io.*;

publicclass serverTest

{

publicstaticvoid main (String[] args)

throws FileNotFoundException

{

PrintWriter outFile =new PrintWriter("home//runblip//public_html//gearscope//java//test.txt");

outFile.print("TEST!!");

outFile.close();

}}

Its just a basic file writer and it works on my PC but not on the server.

Is it that java can't work with the non-absolute path that I have from the server? Could anyone help me out please?

Also, are there any online resources to help with java on Linux, specifically servers?

Thanks in advance!

[1643 byte] By [monk_ha] at [2007-11-27 6:32:05]
# 1
just a thought.... change the // to \\ in your path
izziieea at 2007-7-12 17:57:17 > top of Java-index,Java Essentials,Java Programming...
# 2
i think your java version is below 1.5that constructor exists only since 1.5
j_shadinataa at 2007-7-12 17:57:17 > top of Java-index,Java Essentials,Java Programming...
# 3

Guys thanks for the quick responses.

Two things occurred to me:

Even if i do get the code to compile, I can't figure out how to run it with GCJ

Can anyone help with that?

And second, why am I using GCJ?

Can't I just use the java compiler?

Are there any benefits to GCJ?

monk_ha at 2007-7-12 17:57:17 > top of Java-index,Java Essentials,Java Programming...
# 4

> Even if i do get the code to compile, I can't figure out how to run it with GCJ. Can anyone help with that?

Sorry, i don't know about GCJ. Perhaps it gnu compiler for java.

to run?

$java myClass

> And second, why am I using GCJ?

It was bundled with your linux distro

> Can't I just use the java compiler?

do you mean sun's java compiler? yes, you can download it here: http://java.sun.com/javase/downloads/index.jsp".

j_shadinataa at 2007-7-12 17:57:17 > top of Java-index,Java Essentials,Java Programming...