javac will compile java.util.regex.* jikes won't

A

Alex Polite

I'm just starting out with java.

Here's a playaround thing that uses regex.


import java.util.*;
import java.util.regex.*;
import java.lang.String;
import java.io.*;


//regex.Pattern p = new regex.Pattern(".*");
public class MarkovModel {
public static void main(String[] args) throws IOException{
BufferedReader br = new BufferedReader(new FileReader("test/test1"));
String str;
while ((str = br.readLine()) != null){
String[] sa = str.split(" ");
for (int i=0; i< sa.length; i++) {
System.out.print(sa);
System.out.print(" ");
}
}
}
}





javac will compile this without a hitch.

jikes however has quite a lot to say:

jikes repos/src/java/jdodo/MarkovModel.java

Issued 3 system warnings:

*** Semantic Warning: The file "/usr/share/java/xalan.jar" does not exist or else is not a valid zip file.


*** Semantic Warning: The file "/usr/share/java/xerces.jar" does not exist or else is not a valid zip file.


*** Semantic Warning: The file "/usr/share/java/fop.jar" does not exist or else is not a valid zip file.

Found 2 semantic errors compiling "repos/src/java/jdodo/MarkovModel.java":

3. import java.util.regex.*;
^-------------^
*** Semantic Error: You need to modify your classpath, sourcepath, bootclasspath, and/or extdirs setup. Package "java/util/regex" could not be found in:
 
R

Roedy Green

Here's a playaround thing that uses regex.

the extdirs Jikes command does not work. I reported a bug. Oddly,
some others have reported it working. It may only be failng in some
Jikes versions.
 
A

Alex Polite

the extdirs Jikes command does not work. I reported a bug. Oddly,
some others have reported it working. It may only be failng in some
Jikes versions.

Is there are workaround or am I doomed to using javac?

alex
 
L

Liz

Alex Polite said:
I'm just starting out with java.

Here's a playaround thing that uses regex.


import java.util.*;
import java.util.regex.*;
import java.lang.String;
import java.io.*;


//regex.Pattern p = new regex.Pattern(".*");
public class MarkovModel {
public static void main(String[] args) throws IOException{
BufferedReader br = new BufferedReader(new FileReader("test/test1"));
String str;
while ((str = br.readLine()) != null){
String[] sa = str.split(" ");
for (int i=0; i< sa.length; i++) {
System.out.print(sa);
System.out.print(" ");
}
}
}
}





javac will compile this without a hitch.

jikes however has quite a lot to say:

jikes repos/src/java/jdodo/MarkovModel.java

Issued 3 system warnings:

*** Semantic Warning: The file "/usr/share/java/xalan.jar" does not exist

or else is not a valid zip file.
*** Semantic Warning: The file "/usr/share/java/xerces.jar" does not exist
or else is not a valid zip file.
*** Semantic Warning: The file "/usr/share/java/fop.jar" does not exist or else is not a valid zip file.

Found 2 semantic errors compiling "repos/src/java/jdodo/MarkovModel.java":

3. import java.util.regex.*;
^-------------^
*** Semantic Error: You need to modify your classpath, sourcepath,
bootclasspath, and/or extdirs setup. Package "java/util/regex" could not be
found in:
.
/usr/lib/j2se/1.3//jre/lib/rt.jar
/usr/share/java/xalan.jar
/usr/share/java/xerces.jar
/usr/share/java/fop.jar
.



13. String[] sa = str.split(" ");
^------------^
*** Semantic Error: No method named "split" was found in type "java.lang.String".






Here's version info on the relevant packs.



apt-cache policy j2sdk1.4
j2sdk1.4:
Installed: 1.4.1-6
Candidate: 1.4.1-6
Version Table:
*** 1.4.1-6 0
100 /var/lib/dpkg/status

apt-cache policy jikes
jikes:
Installed: 1:1.18-8
Candidate: 1:1.18-8
Version Table:
*** 1:1.18-8 0
500 http://ftp.se.debian.org unstable/main Packages
100 /var/lib/dpkg/status

alex

compiles on both and runs the same on both for me
i have Jikes Compiler - Version 1.19 - 1 February 2004
 
R

Roedy Green

Is there are workaround or am I doomed to using javac?

I don't know of one, other than putting the jars on the Jikespath or
the command line classpath.
 
A

Alex Polite

It turned out I had j2sdk1.3 installed as well as j2sdk1.4
I guess that 1.3 dosen't contain the regex and got searched before
1.4.

Or something like that. Anyway apt-get remove j2sdk1.3 made the
problem go away.

alex



--
oivvio polite

mobil 0709 304030 / kontor 08 669 64 18 / hem 08 791 90 84
varvsgatan 10a, efter porten / 117 29 stockholm / sweden
epost mailto:eek:[email protected]
onlinearkiv http://polite.se
 
A

Alan Moore

Found 2 semantic errors compiling "repos/src/java/jdodo/MarkovModel.java":

3. import java.util.regex.*;
^-------------^
*** Semantic Error: You need to modify your classpath, sourcepath,
bootclasspath, and/or extdirs setup. Package "java/util/regex"
could not be found in:
.
/usr/lib/j2se/1.3//jre/lib/rt.jar
/usr/share/java/xalan.jar
/usr/share/java/xerces.jar
/usr/share/java/fop.jar
.



13. String[] sa = str.split(" ");
^------------^
*** Semantic Error: No method named "split" was found in type "java.lang.String".

I don't know jikes, but this seems to be saying that it's compiling
against a 1.3 version of the JDK. Regex support, including the
split() method, is only available in 1.4+.
 
G

Gordon Beaton

It turned out I had j2sdk1.3 installed as well as j2sdk1.4
I guess that 1.3 dosen't contain the regex and got searched before
1.4.

Or something like that. Anyway apt-get remove j2sdk1.3 made the
problem go away.

It shouldn't have been necessary to remove 1.3. You can use
bootclasspath to tell jikes where to look for the standard classes,
and point it at whichever of the installed SDKs you want.

/gordon
 
A

Adam

Alex Polite said:
3. import java.util.regex.*;
^-------------^
*** Semantic Error: You need to modify your classpath, sourcepath,
bootclasspath, and/or extdirs setup. Package "java/util/regex" could
not be found in:
.
/usr/lib/j2se/1.3//jre/lib/rt.jar

no regex in 1.3 rt.jar.

[cut]
13. String[] sa = str.split(" ");
^------------^
*** Semantic Error: No method named "split" was found in type
"java.lang.String".

same here

Adam
 
A

Adam

Sorry, missed that it is already solved.
Anyway, careful reading what your compiler tells
you is always good advice.

Adam
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

mod_python help! 1

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top