My aplication doesn't work after update jre1.5.0.11 to 1.6.0.1

I updated java from jre 1.5.0.11 to jre1.6.01 and now my aplication returns 14 errors. Some of the errors are :

Canno find symbol

symbol:class regex.

Then I deleted that update but it still doesn't work. Don't know what to do. Do I need to reinstall all java package?

[330 byte] By [Zdravkoa] at [2007-11-27 3:58:23]
# 1
I don't think it can ever have worked. Assuming that you wrote the program then YOU will know which package class regex is in (it is not part of 1.5 or 1.6) so YOU must have setup the classpath under 1.5 and it will be just the same under 1.6.
sabre150a at 2007-7-12 9:02:49 > top of Java-index,Java Essentials,Java Programming...
# 2
I'm confused now! Regex is in C:\Program Files\Java\jdk1.5.0_11\src.zip Exactly in java/util/regex. I imported it, but got the same
Zdravkoa at 2007-7-12 9:02:49 > top of Java-index,Java Essentials,Java Programming...
# 3
> I'm confused now! Regex is in C:\Program> Files\Java\jdk1.5.0_11\src.zip Exactly in> java/util/regex. I imported it, but got the sameThere is no class regex in java.util.regex so either your code never worked OR you have mis-reported the error message.
sabre150a at 2007-7-12 9:02:50 > top of Java-index,Java Essentials,Java Programming...
# 4

The 1. error is Contact.java:17: cannot find symbol

symbol : class Regex

loation: class Contact

Regex r=new Regex();

The class regex is made by me. I should tell that the my class is regex which importsjava.util.regex: import java.util.regex.*;

public class Regex {

//ulazne varijable

String patStr ="(\\+)*(385|0385|00385)*(\\s)*(\\W)*(0)*(\\W)*(\\s|\\d)*(\\d{3})(\\s|\\d|-)(\\d{3})(\\s|\\d)(\\D)";

String tekst="pope:098 9523 616 mob";

//izlazne varijabe

int start=-1;

int end=-1;

public void find() {

// Compile regular expression

try{

//Pattern p = Pattern.compile(patStr);

//Pattern p = Pattern.compile(patStr, Pattern.CASE_INSENSITIVE);

Pattern p = Pattern.compile(patStr, Pattern.UNICODE_CASE);

Matcher m = p.matcher(tekst);

boolean matchFound = m.find();// true

//System.out.println(matchFound);

if(matchFound==true){

// Get matching string

String match = m.group(); // b

// Get indices of matching string

start = m.start();// 2

end = m.end();// 3

// the end is index of the last matching character + 1

//System.out.println("start= "+start+" end= " + end);

}

else start=-1;

}catch(PatternSyntaxException pse){

System.out.println(pse.getMessage());

}

}

}

Zdravkoa at 2007-7-12 9:02:50 > top of Java-index,Java Essentials,Java Programming...
# 5
So you mis-reported the error!The compilation of the code that has the expressionRegex r=new Regex(); does not have the class path set so that it can find class Regex.
sabre150a at 2007-7-12 9:02:50 > top of Java-index,Java Essentials,Java Programming...
# 6
Excuse me if I ask a stupid question: how to set class path. The file Contact.java (where the class is initialized )and Regex.java are in the same directory.
Zdravkoa at 2007-7-12 9:02:50 > top of Java-index,Java Essentials,Java Programming...
# 7
> Excuse me if I ask a stupid question: how to set> class path. The file Contact.java (where the class is> initialized )and Regex.java are in the same directory.Those are source code files, not classes
georgemca at 2007-7-12 9:02:50 > top of Java-index,Java Essentials,Java Programming...
# 8
The same way you did on 1.5 . Probably something likejavac-classpath.*.java
sabre150a at 2007-7-12 9:02:50 > top of Java-index,Java Essentials,Java Programming...
# 9
>I'm confused now! Regex is in C:\Program Files\Java\jdk1.5.0_11\src.zip >Exactly in java/util/regex. I imported it, but got the sameuse C:\Program Files\Java\jdk1.5.0_11\jre\lib\rt.jar instead.
java_2006a at 2007-7-12 9:02:50 > top of Java-index,Java Essentials,Java Programming...
# 10

Sorry I' ve written rong Contact. class and Regex.class!

But why I don't need to set class path when I compile some other of my classes for example Mysql.class

import java.sql.Connection;

import java.sql.DriverManager;

import java.sql.SQLException;

import java.sql.*;

public class Mysql {

String email; // ulazna varijabla

String tel;// ulazna varijabla

String mob=null;

String place=null;

int reg=0;

String link=null;

float price=0;

String pic1;

String pic2;

String pic3;

public void save (){

//email="zdravko.eskinja@hrbi.hr";//za testne svrhe

//email="nikola.mikulic@hrbi.hr";// za testne svrhe

//tel=" 091 534 9329";

//id=5; //indeks podatka za testne svrhe

int InIt=0;// flag oznacava da li je upisivanje uspjelo ili vec postoji neki takava email

int id;// varijablakoja se sama postavlja - indeks podataka

try {

// The newInstance() call is a work around for some

// broken Java implementations

Class.forName("com.mysql.jdbc.Driver");

} catch (Exception ex) {

// handle the error

System.out.println("ForNameException: " + ex.getMessage());

}

Connection conn = null;

try {

conn =

DriverManager.getConnection("jdbc:mysql://localhost:3306/apartmani" ,"root","10000000");

// Do something with the Connection

Statement stmt = conn.createStatement();

ResultSet rs;

/* rs = stmt.executeQuery("select email from people where id=1");

while ( rs.next() ) {

String Pemail = rs.getString("email");

System.out.println(Pemail);

}

*/

rs=stmt.executeQuery("select max(id) from people"); // trazim redni broj zadnjeg podatka

Integer MaxValue = new Integer(-1);

if(rs.next()){

MaxValue = rs.getInt(1);

}

id=MaxValue+1;

PreparedStatement stmt2 = null;

stmt2 = conn.prepareStatement("INSERT INTO people VALUES ('"+id+"','"+email+"','"+tel+"',NULL,NULL,'"+reg+"',NULL,'"+price+"',?,?,?)");

stmt2.setString(1, pic1);

stmt2.setString(2, pic2);

stmt2.setString(3, pic3);

stmt2.executeUpdate();

ResultSet r2 = stmt2.getResultSet();

//stmt.executeUpdate("INSERT INTO people VALUES('"+id+"',+'"+email+"','"+tel+"',NULL,NULL,0,NULL,0,NULL,'"+pic2+"',NULL)");

conn.close();

InIt=1; //uspjelo je upisivanje u tablicu

System.out.println("InIt = " + InIt);

} catch (SQLException ex) {

// handle any errors

System.out.println("SQLException: " + ex.getMessage());

System.out.println("SQLState: " + ex.getSQLState());

System.out.println("VendorError: " + ex.getErrorCode());

}

} //zavr歛va metoda

} //zavr歛va klasa

Zdravkoa at 2007-7-12 9:02:50 > top of Java-index,Java Essentials,Java Programming...
# 11
are using a java IDE or coding manually ?
java_2006a at 2007-7-12 9:02:50 > top of Java-index,Java Essentials,Java Programming...
# 12
manually!
Zdravkoa at 2007-7-12 9:02:50 > top of Java-index,Java Essentials,Java Programming...
# 13

> >I'm confused now! Regex is in C:\Program

> Files\Java\jdk1.5.0_11\src.zip >Exactly in

> java/util/regex. I imported it, but got the same

>

> use C:\Program

> Files\Java\jdk1.5.0_11\jre\lib\rt.jar

instead.

There is never (well almost never) any need to specify the rt.jar to use since both java and javac pick it up automatically.

sabre150a at 2007-7-12 9:02:50 > top of Java-index,Java Essentials,Java Programming...
# 14
@sabre150 : All right. What I meant is to use rt.jar and not src.zip.@Zdravko: if you compile your java files using the command given by sabre150, what happens ?
java_2006a at 2007-7-12 9:02:50 > top of Java-index,Java Essentials,Java Programming...
# 15
which command.. I think there is no need to set path.. they are in the sam directoryI'm quite sure that it worked before my java update, so my only idea is to reinstall jre, jdk and all connected to java.
Zdravkoa at 2007-7-21 20:59:17 > top of Java-index,Java Essentials,Java Programming...
# 16

> which command..

Reply #8!

> I think there is no need to set

> path.. they are in the sam directory

But it won't hurt to try it will it?

> I'm quite sure that it worked before my java update,

I'm not because nothing should change expect the PATH (not the classpath) to the jre/bin directory.

> so my only idea is to reinstall jre, jdk and all

> connected to java.

Which is silly!

sabre150a at 2007-7-21 20:59:17 > top of Java-index,Java Essentials,Java Programming...
# 17
Ok then I'll first do as you say
Zdravkoa at 2007-7-21 20:59:17 > top of Java-index,Java Essentials,Java Programming...
# 18
You updated from 1.5 to 1.6.There is no longer a 1.5 jdk, right?Have you rebooted your windows box since?
xiarcela at 2007-7-21 20:59:17 > top of Java-index,Java Essentials,Java Programming...
# 19
Yes I restarted it if you mean that.For Sabre150:Wrote this:javac -classpath C:\projects\aplication\Frita1005\Contact.java Contact .javaGot the same
Zdravkoa at 2007-7-21 20:59:17 > top of Java-index,Java Essentials,Java Programming...
# 20
Also now is jre 1.5.0.11, I deleted update
Zdravkoa at 2007-7-21 20:59:17 > top of Java-index,Java Essentials,Java Programming...
# 21

> Yes I restarted it if you mean that.

> For Sabre150:

> Wrote this:

> > javac -classpath

> C:\projects\aplication\Frita1005\Contact.java Contact

> .java

>

> Got the same

THAT IS NOT WHAT I SAID TO DO!

I give up. You obviously don't listen.

sabre150a at 2007-7-21 20:59:17 > top of Java-index,Java Essentials,Java Programming...
# 22
Sorry I didn't understand. How to set the path then
Zdravkoa at 2007-7-21 20:59:17 > top of Java-index,Java Essentials,Java Programming...
# 23
> Sorry I didn't understand. How to set the path thenWhat the **** did I say in #8!
sabre150a at 2007-7-21 20:59:17 > top of Java-index,Java Essentials,Java Programming...
# 24

>javac -classpath C:\projects\aplication\Frita1005\Contact.java Contact .java

Sir,

Do the following :

1 - open MS-DOS

2 - type : cd C:\projects\aplication\Frita1005\ then press [Enter]

3 - compile like the following: javac -classpath . *.java

4 - tell us what happens plz

java_2006a at 2007-7-21 20:59:17 > top of Java-index,Java Essentials,Java Programming...
# 25
Good try java_2006 but the OP won't do it.
sabre150a at 2007-7-21 20:59:17 > top of Java-index,Java Essentials,Java Programming...
# 26

Copy of Mysql.java:7: class Mysql is public, should be declared in a file named Mysql.java

public class Mysql {

Mysql.java:7: duplicate class: Mysql

public class Mysql {

Note: Glavni.java uses or overrides a deprecated API.

Note: Recompile with -Xlint: deprecation for details.

2 errors

Zdravkoa at 2007-7-21 20:59:17 > top of Java-index,Java Essentials,Java Programming...
# 27
You have two copies of your java source in the same directory or in the path.
xiarcela at 2007-7-21 20:59:17 > top of Java-index,Java Essentials,Java Programming...
# 28
remove Copy of Mysql.java file and try again
java_2006a at 2007-7-21 20:59:17 > top of Java-index,Java Essentials,Java Programming...
# 29
You really should looks closely at error messages. You have a file called "Copy of Mysql.java" in your directory.
sabre150a at 2007-7-21 20:59:17 > top of Java-index,Java Essentials,Java Programming...
# 30
Tried againNote: Glavni.java uses or overrides a deprecated API.Note: Recompile with -Xlint: deprecation for details.
Zdravkoa at 2007-7-21 20:59:22 > top of Java-index,Java Essentials,Java Programming...
# 31
Which is just a warning and can be ignored.
sabre150a at 2007-7-21 20:59:22 > top of Java-index,Java Essentials,Java Programming...
# 32
and when I compile Contact.java I got the same
Zdravkoa at 2007-7-21 20:59:22 > top of Java-index,Java Essentials,Java Programming...
# 33
> and when I compile Contact.java I got the sameJesus! Ignore the ******* warning!
sabre150a at 2007-7-21 20:59:22 > top of Java-index,Java Essentials,Java Programming...
# 34
If you'd like to avoid such warning, compile your java sources like the following: javac -Xlint -classpath . *.java
java_2006a at 2007-7-21 20:59:22 > top of Java-index,Java Essentials,Java Programming...
# 35
not that the sameI got 14 errors like can't find symbolsymbol class regex
Zdravkoa at 2007-7-21 20:59:22 > top of Java-index,Java Essentials,Java Programming...
# 36
same thing like in beginning
Zdravkoa at 2007-7-21 20:59:22 > top of Java-index,Java Essentials,Java Programming...
# 37

> not that the same

> I got 14 errors like can't find symbol

> symbol class regex

If you only got warnings when you compiled with

javac -classpath . *.java

then all your java classes compiled OK.

What command are you typing and what is the full error set?

sabre150a at 2007-7-21 20:59:22 > top of Java-index,Java Essentials,Java Programming...
# 38

C:\projects\aplication\Frita1005>javac Contact.java

Contact.java:17: cannot find symbol

symbol : class Regex

location: class Contact

Regex r=new Regex();

^

Contact.java:17: cannot find symbol

symbol : class Regex

location: class Contact

Regex r=new Regex();

^

Contact.java:105: operator + cannot be applied to Regex.start,int

phone =LineBuff.substring(r.start+1,r.en

d-1);//izdvajam adresu i smje

stam je u zasebni string

^

Contact.java:105: cannot find symbol

symbol : method substring(<nulltype>,int)

location: class java.lang.String

phone =LineBuff.substring(r.start+1,r.en

d-1);//izdvajam adresu i smje

stam je u zasebni string

^

Contact.java:139: operator + cannot be applied to Regex.start,int

pic=line.substring(r.start+9,r.end-1);

^

Contact.java:139: cannot find symbol

symbol : method substring(<nulltype>,int)

location: class java.lang.String

pic=line.substring(r.start+9,r.end-1);

^

Contact.java:157: operator + cannot be applied to Regex.start,int

sirina=whb.substring(r.start+7,r.end);

^

Contact.java:166: operator + cannot be applied to Regex.start,int

visina=whb.substring(r.start+8,r.end);

^

Contact.java:204: operator + cannot be applied to Regex.start,int

Sflag+=(r.start+1);

^

Contact.java:204: inconvertible types

found: <nulltype>

required: int

Sflag+=(r.start+1);

^

Contact.java:205: operator + cannot be applied to Regex.start,int

PomT=PomT.substring(r.start+1);

^

Contact.java:205: cannot find symbol

symbol : method substring(<nulltype>)

location: class java.lang.String

PomT=PomT.substring(r.start+1);

^

Contact.java:292: cannot find symbol

symbol : class Mysql

location: class Contact

Mysql DB=new Mysql();

^

Contact.java:292: cannot find symbol

symbol : class Mysql

location: class Contact

Mysql DB=new Mysql();

^

14 errors

C:\projects\aplication\Frita1005>

Zdravkoa at 2007-7-21 20:59:22 > top of Java-index,Java Essentials,Java Programming...
# 39
Your really don't listen do you! Why do you think we said usejava -classpath . *.java
sabre150a at 2007-7-21 20:59:22 > top of Java-index,Java Essentials,Java Programming...
# 40
I listenn, but don't understand. What I messed up now?
Zdravkoa at 2007-7-21 20:59:22 > top of Java-index,Java Essentials,Java Programming...
# 41

> I listenn, but don't understand. What I messed up now?

To break it down

1) javac says compile

2) -classpath .says use this directory (that is what the . signifies) to find any classes that are not system classes

3) *.javaAll my java files in this directory.

sabre150a at 2007-7-21 20:59:22 > top of Java-index,Java Essentials,Java Programming...
# 42

Thank you guys, but I'm obviously to dumb to get it. I see that generated .class files but when I run class java which uses method from Contact I get this:

C:\projects\aplication\Frita1005>java Testing

Exception in thread "main" java.lang.NoClassDefFoundError: Testing

C:\projects\aplication\Frita1005>

Zdravkoa at 2007-7-21 20:59:22 > top of Java-index,Java Essentials,Java Programming...
# 43
No hard feelings, You are the best, I appreciate your effort.
Zdravkoa at 2007-7-21 20:59:22 > top of Java-index,Java Essentials,Java Programming...
# 44
Wow!java -classpath .Testingbut I suspect you will have to add the jdbc driver jar to the classpath.
sabre150a at 2007-7-21 20:59:22 > top of Java-index,Java Essentials,Java Programming...
# 45
I lost my nerves. I' ll try tomorrow!
Zdravkoa at 2007-7-21 20:59:27 > top of Java-index,Java Essentials,Java Programming...
# 46
I tried yesterday.. It really works! Thank you guys. Thanks for potience with me. I couldn't understand that now in jre 1.6.01 is all the same except the difference in puting -classpath . after javac or java.
Zdravkoa at 2007-7-21 20:59:27 > top of Java-index,Java Essentials,Java Programming...