Bug 9157 - My existing .class files are deleted!
Summary: My existing .class files are deleted!
Status: RESOLVED WORKSFORME
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.0   Edit
Hardware: PC Windows 2000
: P1 normal (vote)
Target Milestone: 2.0 M4   Edit
Assignee: Kent Johnson CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-02-06 07:22 EST by Ghica van Emde Boas CLA
Modified: 2002-03-01 04:38 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ghica van Emde Boas CLA 2002-02-06 07:22:31 EST
AAAAAAARGH!!!
I tried to get rid of the useless SanFrancisco project I created. I clicked
delete project, and I was VERY careful to reply NO to the question if I
wanted to delete all files in the project. Then, I received a messgae
whether I wanted to delete selected read-only files. I said NO again, but
then my project stayed. So I tryed again, said NO again first, and then yes
to the read only things (thinking these were some private eclipse files).
Some time later (because I thought, maybe I can create some jar files, just
for the purpose of fooling eclipse) I found that ALL my class files were
GONE. The 20,000 other files were still there.

I had to re-install the IBM SanFrancisco framework, and I was just soooo
happy that I did not try this on my daily work PC!
===> what did eclipse do with my class files??? <===

Regards, Ghica.

"Ghica van Emde Boas" <emdeboas@bronstee.com> wrote in message
news:a3r0vr$vks$1@rogue.oti.com...
> This is what happened while crating the SanFrancisco project:
>
>     java.lang.ArrayOutOfBoundsException encountered while running
>        org.eclipse.jdt.internal.core.newbuilder.JavaBuilder.
>
> And, I have now a project with about 20.000 files (html, resources, etc),
> but NO .class files. This is the opposite of what I need!
>
> Regards, Ghica.
>
> "David Wegener" <wegener@mcs.net> wrote in message
> news:a3nh7q$utt$1@rogue.oti.com...
> > Create a project called SanFracisco and point to the d:\sf directory
> instead
> > of using the default location.  Create a second project called My
project
> > and point it at c:\myproject.  You will need to use the src directory
> option
> > if myproject isn't the root of your package structure.  On the projects
> tab
> > for myproject select SanFrancisco.  This will place the SanFrancisco
> classes
> > in your classpath.
> >
> > Dave Wegener
> > "Ghica van Emde Boas" <emdeboas@bronstee.com> wrote in message
> > news:a3n3h3$rb7$1@rogue.oti.com...
> > > I would really like to restart on my attempt to use eclipse for my
daily
> > > Java work. But I am stuck...
> > > Can someone solve this for me, or am I out of luck?
> > >
> > > This is the directory set-up, there is no way I can change it:
> > > The IBM SanFrancisco framework consists of some 6000 class files,
> located
> > in
> > > d:\sf\sf210\... (no jars, no source code)
> > >
> > > My project  is located in c:\myproject
> > >
> > > My question, is there any way to define a Java project for this setup
in
> > > Eclipse??
> > > I have searched for a way to use a set of external class files, but I
> > cannot
> > > find it.
> > >
> > > Ghica.

Martin Möbius wrote:
>>>Best is to fill a bug report against jdt-core. Also the exception you got
>>>seems "wrong".

Cheers! Ghica
Comment 1 Philipe Mulet CLA 2002-02-07 10:04:28 EST
Which build number are you using ? Which platform (win32 or Linux) ?
Something did go definitely wrong on our end...
Comment 2 Ghica van Emde Boas CLA 2002-02-07 15:16:10 EST
The build I was using was the 20011206 stable build, platform W2K.
Martin Mobius wrote this in the forum:
>I tried to get a smaller libary just with classes to a classpath. Seems
>there is no way. Strange things happend, and in the end all my class files
>were gone. So be aware with experiments!

That was too late for me, but it must be easy to recreate.
Comment 3 Kent Johnson CLA 2002-02-13 17:21:35 EST
When you define a new Java project with an empty source folder but 
numerous .class files in the 'bin' directory, the builder will delete them when 
it tries to compile the .java files. Every .class file in the bin directory is 
the result of compiling a .java file.

To add a project which you do not have source for & as a result will not 
modify, you should not define source or bin folders, but instead add the 
necessary jar files.

Why can you not build jar files from the .class files?
Comment 4 Ghica van Emde Boas CLA 2002-02-14 06:52:56 EST
>>Why can you not build jar files from the .class files?

This is the wrong question. I just cannot. 
I am part of a very large project.

Of course I made some jars as a workaround to be able to try out Eclipse.
Still, I think you should fix this. Such are the facts of life.
Even if I could make jars, it is no excuse for wiping out my class files!
Comment 5 Kent Johnson CLA 2002-02-14 11:54:51 EST
Sorry but I think you missed my point. A .class file is the result of compiling 
a .java file. Class files are not stand alone resources. So the first step of a 
project build which contains source files is to wipe the output directory.

Can you add the source files instead of the class files?
Comment 6 Ghica van Emde Boas CLA 2002-02-15 05:07:59 EST
Maybe you missed my point too.
The IBM SanFrancisco framework is provided as a directory structure with about 
6000 class files. For reference there is -some- source too, but by no means all 
of it. 
What I meant to say is, that if you are working in a large project, then the 
project structure is a given for most developers. I cannot change it, just 
because as an individual developer I would like to use Eclipse. I am trying to 
use Eclipse, because if successful, I may try to promote using Eclipse by a 
larger group of developers at the company I am currently working for. This 
company has a large ordering application based on the IBM SanFrancisco 
framework.

The Java environment does in no way force you to use jars. Neither should 
Eclipse. I agree that it would be better to use jars, but again, it is a fact 
of life that I cannot. I can understand why Eclipse is wiping out my class 
files, but I still think that this is a show-stopper bug. Before trying to 
recompile soething, Eclipse should check whether the source code is actually 
available. The only thing I ever wanted to configure for my project is 
saying: "here is a directory full of class files. Do not touch it!", in the 
same way as you can use external jars. Again, it is not in my power to make 
jars out of the class files, and I do not have the source (only IBM has it). 

To summarize: I have a directory full of class files, I have no source. This is 
valid Java, please let me use Eclipse! (and do not destroy my stuff).
Regards, Ghica.
Comment 7 Kent Johnson CLA 2002-02-15 12:16:13 EST
Sorry I didn't know this was already possible... you can add additional folders 
with other class files to your build path.

1. Define your project with new empty source & bin folders that do not conflict 
with existing directories.
2. Then add a 'new' generic folder to the project which matches the existing 
directory with all the class files.
3. Then add this folder to the project's Java Build Path -> Libraries tab.

All the class files will be visible & will be left as is.

Please let us know if this solution works for you.
Comment 8 Ghica van Emde Boas CLA 2002-02-19 11:06:27 EST
You wrote:
>> Please let us know if this solution works for you.

Well, I saw that, after jumping through some hoops, I can indeed have a 
directory full of classes without source. Eclipse wants to own the 30,000 other 
files except the 6000 class files in that directory also. I do not like that at 
all.

I did not check yet wether I can have my source on c:\ and my framework classes 
on d:\ and I do not NOT want to try whether the latest stable version of 
Eclipse (20020214) will still wipe out my class files if given an empty source 
library. And, I still get very mysterious error messages like: 
An error occurred while creating the java project - Invalid project 
description - Details: c:/myproj/mysub and c:/myproj/mysub overlap.

Eclipse is a brave attempt to set a new standard for IDE's. It is therefore 
very disappointing that it has such a limiting concept of what a project is. 
For the IDE's I used before, I was used to be able to define any classpath, 
source path or output path, as long as allowed by java or javac. Even VAJ would 
never interfere in unexpected ways with my filesystem. Eclipse is definitely a 
step back in this respect and I sincerely hope that it will not stay that way.
Comment 9 Kent Johnson CLA 2002-02-25 11:36:25 EST
"Eclipse wants to own the 30,000 other files except the 6000 class files in 
that directory also."

Sorry I don't understand what you mean. Eclipse does not copy/delete any files 
in a class file directory. It just adds the directory to the build path. Its 
not included as a source folder in the build.

"I did not check yet wether I can have my source on c:\ and my framework 
classes on d:\ and I do not NOT want to try whether the latest stable version 
of Eclipse (20020214) will still wipe out my class files if given an empty 
source library."

Then what else can we do to help? There is clearly a workable solution to your 
problem.

"Even VAJ would never interfere in unexpected ways with my filesystem."

VAJ did not store class files in the filesystem. It stored them in its own 
library so the comparison is not valid.
Comment 10 Kent Johnson CLA 2002-02-27 12:32:15 EST
A workable solution exists for this problem.

Users have control when creating a new project in which they do not intend to 
develop/modify the available source.