Runnable Jar File Does Not Execute Code Correctly
<p>I have made a little game in java and everything has been fine up to this point; when i have tested the game in the eclipse run environment the game works fine and there are no error messages. I then decide to make this into an executable jar file and so, export -> runnable jar file -> exctract packages -> finish. It is now a runnable file.
When running this only certain parts of the code then just decide to work.</p>

<p>For example: the game spawns 'boxes' randomly across the screen (the code works in eclipse just not in the runnable version) :</p>

<pre><code>01
public void addTimers() {
02
        boxTimer = new Timer(5, new ActionListener() {
03
            public void actionPerformed(ActionEvent e) {
04
                if (boxes.size() &lt; 20 &amp;&amp; !titleScreen) {
05
                    boxes.add(new Box(BOARD_WIDTH, BOARD_HEIGHT));
06
                }
07
            }
08
        });
09
        boxTimer.start();
10
    }
</code></pre>

<p>Also: if a players health is less than or equal to 0 a win message is displayed (again the code works in exlipse just not in the runnable version):</p>

<pre><code>1
} else if (wizard1.getHealth() &lt;= 0) {
2
    drawWin(wizard2, gx);
3
} else if (wizard2.getHealth() &lt;= 0) {
4
    drawWin(wizard1, gx);
5
}
</code></pre>

<p>Here are some of the errors from going to window->show view->error log:</p>

<pre><code>1. While loading class "org.eclipse.team.internal.ccvs.core.CVSWorkspaceSubscriber", thread "Thread[main,6,main]" timed out waiting (5007ms) for thread "Thread[Worker-3,5,main]" to finish starting bundle "org.eclipse.team.cvs.core_3.3.400.I20110510-0800 [251]". To avoid deadlock, thread "Thread[main,6,main]" is proceeding but "org.eclipse.team.internal.ccvs.core.CVSWorkspaceSubscriber" may not be fully initialized.

2. JavaBuilder handling ImageBuilderInternalException while building: Game Practice

3. Resource is out of sync with the file system: '/Game Practice/src/resources/shield.png'.
</code></pre>

<p>Here's a stack trace for the first error:</p>

<pre><code>org.eclipse.core.internal.resources.ResourceException: Problems encountered while copying resources.
at org.eclipse.core.internal.localstore.FileSystemResourceManager.copy(FileSystemResourceManager.java:314)
at org.eclipse.core.internal.resources.Resource.copy(Resource.java:542)
at org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.copyResource(AbstractImageBuilder.java:379)
at org.eclipse.jdt.internal.core.builder.IncrementalImageBuilder.findSourceFiles(IncrementalImageBuilder.java:666)
at org.eclipse.jdt.internal.core.builder.IncrementalImageBuilder.findSourceFiles(IncrementalImageBuilder.java:545)
at org.eclipse.jdt.internal.core.builder.IncrementalImageBuilder.findSourceFiles(IncrementalImageBuilder.java:496)
at org.eclipse.jdt.internal.core.builder.IncrementalImageBuilder.build(IncrementalImageBuilder.java:96)
at org.eclipse.jdt.internal.core.builder.JavaBuilder.buildDeltas(JavaBuilder.java:265)
at org.eclipse.jdt.internal.core.builder.JavaBuilder.build(JavaBuilder.java:193)
at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:728)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:199)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:239)
at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:292)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:295)
at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:351)
at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:374)
at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:143)
at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:241)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Contains: Could not read file: L:\Coursework\Computing project\Workspace\Game Practice\src\resources\wizard1win.png.
java.io.FileNotFoundException: L:\Coursework\Computing project\Workspace\Game Practice\src\resources\wizard1win.png (The process cannot access the file because it is being used by another process)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.&lt;init&gt;(Unknown Source)
at org.eclipse.core.internal.filesystem.local.LocalFile.openInputStream(LocalFile.java:362)
at org.eclipse.core.filesystem.provider.FileStore.copyFile(FileStore.java:220)
at org.eclipse.core.filesystem.provider.FileStore.copy(FileStore.java:143)
at org.eclipse.core.internal.filesystem.local.LocalFile.copy(LocalFile.java:111)
at org.eclipse.core.internal.localstore.CopyVisitor.copyContents(CopyVisitor.java:100)
at org.eclipse.core.internal.localstore.CopyVisitor.copy(CopyVisitor.java:71)
at org.eclipse.core.internal.localstore.CopyVisitor.visit(CopyVisitor.java:202)
at org.eclipse.core.internal.localstore.UnifiedTree.accept(UnifiedTree.java:110)
at org.eclipse.core.internal.localstore.FileSystemResourceManager.copy(FileSystemResourceManager.java:311)
at org.eclipse.core.internal.resources.Resource.copy(Resource.java:542)
at org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.copyResource(AbstractImageBuilder.java:379)
at org.eclipse.jdt.internal.core.builder.IncrementalImageBuilder.findSourceFiles(IncrementalImageBuilder.java:666)
at org.eclipse.jdt.internal.core.builder.IncrementalImageBuilder.findSourceFiles(IncrementalImageBuilder.java:545)
at org.eclipse.jdt.internal.core.builder.IncrementalImageBuilder.findSourceFiles(IncrementalImageBuilder.java:496)
at org.eclipse.jdt.internal.core.builder.IncrementalImageBuilder.build(IncrementalImageBuilder.java:96)
at org.eclipse.jdt.internal.core.builder.JavaBuilder.buildDeltas(JavaBuilder.java:265)
at org.eclipse.jdt.internal.core.builder.JavaBuilder.build(JavaBuilder.java:193)
at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:728)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:199)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:239)
at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:292)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:295)
at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:351)
at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:374)
at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:143)
at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:241)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
</code></pre>

<hr>

<p>Again, these errors don't seem to come up when playing the game in eclipse but when extracted into a runnable jar file happen. </p>
