Force compile java files with errors?

  • (2 Pages)
  • +
  • 1
  • 2

15 Replies - 9954 Views - Last Post: 09 August 2009 - 08:15 PM Rate Topic: -----

#1 chetanpatil1984  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 11
  • Joined: 01-January 09

Force compile java files with errors?

Posted 08 August 2009 - 09:54 AM

Hi friends...

I am trying to compile J2SE source code. Compilation of some files give errors. Is there a way to force compile or partially compile such java files into .class files?

Also, I am surprised that J2SE source has so many compilation errors.
Is This A Good Question/Topic? 0
  • +

Replies To: Force compile java files with errors?

#2 Locke  Icon User is offline

  • Sarcasm Extraordinaire!
  • member icon

Reputation: 521
  • View blog
  • Posts: 5,596
  • Joined: 20-March 08

Re: Force compile java files with errors?

Posted 08 August 2009 - 09:59 AM

View Postchetanpatil1984, on 8 Aug, 2009 - 10:54 AM, said:

Hi friends...

I am trying to compile J2SE source code. Compilation of some files give errors. Is there a way to force compile or partially compile such java files into .class files?

Also, I am surprised that J2SE source has so many compilation errors.


Why would you want them to be .class files? None of them have a main method as far as I know.
Was This Post Helpful? 0
  • +
  • -

#3 KYA  Icon User is offline

  • g++ jameson.cpp -o beverage
  • member icon

Reputation: 3106
  • View blog
  • Posts: 19,145
  • Joined: 14-September 07

Re: Force compile java files with errors?

Posted 08 August 2009 - 10:00 AM

I don't think so. Evidently, the errors are syntax or cannot find something problems, which should be easily fixable.

Errors are there for a reason, in Netbeans you can force start even if the compile found errors, but it won't run properly (i.e. when it hits the line with the error(s)).
Was This Post Helpful? 0
  • +
  • -

#4 chetanpatil1984  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 11
  • Joined: 01-January 09

Re: Force compile java files with errors?

Posted 08 August 2009 - 10:13 AM

Thank you for your quick response..

I need to initially generate .class files from .java files. After loading .class files, I need to analyse each class using java reflection API.

My project is to automatically detect Composite design pattern in Java 1.4 source code.

So first I need to compile whole of java 1.4 source code and analyse all the class files. Currently, I am facing problem compiling java.awt.Container class, which has 12 errors in it. If I cannot compile it, I cannot analyse it. If I cannot analyse it, I will be missing few design pattern instances.
Was This Post Helpful? 0
  • +
  • -

#5 KYA  Icon User is offline

  • g++ jameson.cpp -o beverage
  • member icon

Reputation: 3106
  • View blog
  • Posts: 19,145
  • Joined: 14-September 07

Re: Force compile java files with errors?

Posted 08 August 2009 - 10:16 AM

Are you trying to compile the actual java source? Navigate to your java install and open the src folder, you should then have all the dependencies needed to compile from source.

If it's something you're writing yourself (unclear from your post) then you could post it here (if its not too long) with the errors are we can help you out.
Was This Post Helpful? 0
  • +
  • -

#6 chetanpatil1984  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 11
  • Joined: 01-January 09

Re: Force compile java files with errors?

Posted 08 August 2009 - 10:47 AM

View PostKYA, on 8 Aug, 2009 - 09:16 AM, said:

Are you trying to compile the actual java source? Navigate to your java install and open the src folder, you should then have all the dependencies needed to compile from source.

If it's something you're writing yourself (unclear from your post) then you could post it here (if its not too long) with the errors are we can help you out.



Yes, I am try to compile actual java source (1.4 or 1.6).

There are many other class which donot compile, but for me important is java.awt.Container class. Following is the error message for java.awt.Container class

C:\Program Files\Java\jdk1.6.0_07\src\java\awt\Container.java:399: checkTreeLock() in java.awt.Container cannot override checkTreeLock() in java.awt.Component; overridden method is final
	void checkTreeLock() {
		 ^
C:\Program Files\Java\jdk1.6.0_07\src\java\awt\Container.java:481: valid has private access in java.awt.Component
			if (valid) {
				^
C:\Program Files\Java\jdk1.6.0_07\src\java\awt\Container.java:764: valid has private access in java.awt.Component
		if (valid) {
			^
C:\Program Files\Java\jdk1.6.0_07\src\java\awt\Container.java:1058: valid has private access in java.awt.Component
		if (valid) {
			^
C:\Program Files\Java\jdk1.6.0_07\src\java\awt\Container.java:1154: valid has private access in java.awt.Component
		if (valid) {
			^
C:\Program Files\Java\jdk1.6.0_07\src\java\awt\Container.java:1254: valid has private access in java.awt.Component
		if (valid) {
			^
C:\Program Files\Java\jdk1.6.0_07\src\java\awt\Container.java:1406: valid has private access in java.awt.Component
	if (valid) {
		^
C:\Program Files\Java\jdk1.6.0_07\src\java\awt\Container.java:1480: valid has private access in java.awt.Component
	if (!valid) {
		 ^
C:\Program Files\Java\jdk1.6.0_07\src\java\awt\Container.java:1483: valid has private access in java.awt.Component
		if (!valid && peer != null) {
			 ^
C:\Program Files\Java\jdk1.6.0_07\src\java\awt\Container.java:1492: valid has private access in java.awt.Component
			valid = true;
			^
C:\Program Files\Java\jdk1.6.0_07\src\java\awt\Container.java:1515: valid has private access in java.awt.Component
	if (!valid) {
		 ^
C:\Program Files\Java\jdk1.6.0_07\src\java\awt\Container.java:1525: valid has private access in java.awt.Component
			&& !comp.valid) {
					^
C:\Program Files\Java\jdk1.6.0_07\src\java\awt\Container.java:1535: valid has private access in java.awt.Component
	valid = true;
	^
C:\Program Files\Java\jdk1.6.0_07\src\java\awt\Container.java:1550: valid has private access in java.awt.Component
			if (comp.valid) {
					^
C:\Program Files\Java\jdk1.6.0_07\src\java\awt\Container.java:1555: valid has private access in java.awt.Component
		if (valid) {


valid is a boolean variable with default(package) access level in java.awt.Component class.

Any ideas why I get these error messages.

-Thanks
Was This Post Helpful? 0
  • +
  • -

#7 chetanpatil1984  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 11
  • Joined: 01-January 09

Re: Force compile java files with errors?

Posted 08 August 2009 - 01:29 PM

Update:

Have you observed that Eclipse IDE generates .class file in bin directory even if there are java syntax error in file.

I want to do similar stuff, generate .class files, even when there are errors programmatically.
Was This Post Helpful? 0
  • +
  • -

#8 chetanpatil1984  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 11
  • Joined: 01-January 09

Re: Force compile java files with errors?

Posted 08 August 2009 - 01:55 PM

Problem Solved:

Used Eclipse Compiler instead of Sun Java Compiler

Enabled -Proceedonerrors compiler option to generate .class file even when there are errors in .java file.

Yaah Yaaaah... Thank you guys for all your advice.
Was This Post Helpful? 0
  • +
  • -

#9 pbl  Icon User is offline

  • There is nothing you can't do with a JTable
  • member icon

Reputation: 8342
  • View blog
  • Posts: 31,880
  • Joined: 06-March 08

Re: Force compile java files with errors?

Posted 09 August 2009 - 06:32 PM

View Postchetanpatil1984, on 8 Aug, 2009 - 12:55 PM, said:

Problem Solved:

Used Eclipse Compiler instead of Sun Java Compiler

Enabled -Proceedonerrors compiler option to generate .class file even when there are errors in .java file.

Yaah Yaaaah... Thank you guys for all your advice.

Wouldn't rely on a program genberated that way
hope it is for a game or something like that not for an ATM or a medical device :D
Was This Post Helpful? 0
  • +
  • -

#10 Locke  Icon User is offline

  • Sarcasm Extraordinaire!
  • member icon

Reputation: 521
  • View blog
  • Posts: 5,596
  • Joined: 20-March 08

Re: Force compile java files with errors?

Posted 09 August 2009 - 07:43 PM

View Postpbl, on 9 Aug, 2009 - 07:32 PM, said:

Wouldn't rely on a program genberated that way
hope it is for a game or something like that not for an ATM or a medical device :D


I wonder how many lives that would cost. :lol:
Was This Post Helpful? 0
  • +
  • -

#11 KYA  Icon User is offline

  • g++ jameson.cpp -o beverage
  • member icon

Reputation: 3106
  • View blog
  • Posts: 19,145
  • Joined: 14-September 07

Re: Force compile java files with errors?

Posted 09 August 2009 - 07:52 PM

Don't be silly, all mission critical systems prone to failure are written in C++ with at least three pointer problems. ;)
Was This Post Helpful? 0
  • +
  • -

#12 Locke  Icon User is offline

  • Sarcasm Extraordinaire!
  • member icon

Reputation: 521
  • View blog
  • Posts: 5,596
  • Joined: 20-March 08

Re: Force compile java files with errors?

Posted 09 August 2009 - 08:03 PM

View PostKYA, on 9 Aug, 2009 - 08:52 PM, said:

Don't be silly, all mission critical systems prone to failure are written in C++ with at least three pointer problems. ;)


Oh right. I totally forgot. Damn incessant memory leaks. :D

Edit: Nah, I won't start an argument. :)

This post has been edited by Locke: 09 August 2009 - 08:04 PM

Was This Post Helpful? 0
  • +
  • -

#13 KYA  Icon User is offline

  • g++ jameson.cpp -o beverage
  • member icon

Reputation: 3106
  • View blog
  • Posts: 19,145
  • Joined: 14-September 07

Re: Force compile java files with errors?

Posted 09 August 2009 - 08:09 PM

View PostLocke, on 9 Aug, 2009 - 08:03 PM, said:

View PostKYA, on 9 Aug, 2009 - 08:52 PM, said:

Don't be silly, all mission critical systems prone to failure are written in C++ with at least three pointer problems. ;)


Oh right. I totally forgot. Damn incessant memory leaks. :D

Edit: Nah, I won't start an argument. :)



Aw, I wasn't arguing, I was agreeing :lol:
Was This Post Helpful? 0
  • +
  • -

#14 Locke  Icon User is offline

  • Sarcasm Extraordinaire!
  • member icon

Reputation: 521
  • View blog
  • Posts: 5,596
  • Joined: 20-March 08

Re: Force compile java files with errors?

Posted 09 August 2009 - 08:11 PM

View PostKYA, on 9 Aug, 2009 - 09:09 PM, said:

Aw, I wasn't arguing, I was agreeing :lol:


Did you see it?
Was This Post Helpful? 0
  • +
  • -

#15 KYA  Icon User is offline

  • g++ jameson.cpp -o beverage
  • member icon

Reputation: 3106
  • View blog
  • Posts: 19,145
  • Joined: 14-September 07

Re: Force compile java files with errors?

Posted 09 August 2009 - 08:13 PM

No, I was hoping you'd put it back.
Was This Post Helpful? 0
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2