Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (581)
Games in Android Showcase (162)
games submitted by our members
Games in WIP (632)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  File Creating Problem. [need help]  (Read 659 times)
0 Members and 1 Guest are viewing this topic.
Offline GlennBrann
« Posted 2013-12-11 13:41:06 »

Hey Everyone,

Ok, so i have windows 8 and i have a mac also. When i play my game on the mac and windows 8 it creates the files perfectly without fail. But for some reason my friend who has windows vista home premium seems to be having a problem when he plays it. It's not creating the saves folder with a save.txt file it. Like it said it works on all my computers. Is this a problem with him using windows vista? his java is up to date and everything.

Here is the code i'm using to create the files. Maybe someone could help me fix the problem if it can be fixed

   public static void saveGame(String path){
         File theDir = new File("saves");
           if (!theDir.exists()) {
             boolean result = theDir.mkdir();  
              if(result) {    
                System.out.println("DIR created");  
         File file = new File(path);
         FileOutputStream fo = new FileOutputStream(file);
         ObjectOutputStream os = new ObjectOutputStream(fo);
         System.out.println("Game Saved.");
      }catch(Exception e){
         System.out.println("Could Not Save Game!");
         throw new RuntimeException(e);

- GlennBrann
Offline SHC
« Reply #1 - Posted 2013-12-11 13:46:09 »

What is the output it gave to the console?

Offline GlennBrann
« Reply #2 - Posted 2013-12-11 13:52:22 »

It gives no errors in the console for me in eclipse. but when my friend runs it on his computer it doesn't create the folder with the save.txt in it. But when i run it on my mac and my windows 8 it works perfectly. He is using windows vista. does that effect it from creating the files ?
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Online trollwarrior1
« Reply #3 - Posted 2013-12-11 13:53:25 »

If it doesn't create the files it throws an exception at your friends computer. We are asking for that exception.
Offline GlennBrann
« Reply #4 - Posted 2013-12-11 13:57:58 »

I didn't realise that i could find out what exception he is getting. how do i do this with out using eclipse or does he have to have eclipse ?
Offline SHC
« Reply #5 - Posted 2013-12-11 14:00:11 »

Run the JAR from the Command Prompt.

pushd <Drag the Directory of the game>
java -jar <Drag the JAR file of the game>

Offline GlennBrann
« Reply #6 - Posted 2013-12-11 14:02:14 »

ok thanks. let me get him to do that and ill get back to you guys. Thanks for the help
Offline GlennBrann
« Reply #7 - Posted 2013-12-11 14:54:02 »

Ok so it seems i have fixed the problem. When he ran it using the CMD prompt it actually created the files. so now i have a .BAT file for windows users. Thanks a lot for your help everyone Smiley
Offline SHC
« Reply #8 - Posted 2013-12-11 15:05:07 »

The culprit may be permissions given to java. If ran through CMD, it get's some extra privileges. Did you run the CMD as administrator?

Offline GlennBrann
« Reply #9 - Posted 2013-12-11 15:09:45 »

No he didn't use the Admin CMD.
Pages: [1]
  ignore  |  Print  
You cannot reply to this message, because it is very, very old.

MrMapcom (10 views)
2015-05-23 20:26:16

MrMapcom (10 views)
2015-05-23 20:23:34

Waterwolf (28 views)
2015-05-20 15:01:45

chrislo27 (34 views)
2015-05-20 03:42:21

BurntPizza (69 views)
2015-05-10 15:53:18

FrozenShade (55 views)
2015-05-07 09:11:21

TheLopais (217 views)
2015-05-06 13:36:48

TheLopais (201 views)
2015-05-06 13:35:14

TheLopais (206 views)
2015-05-06 13:33:39

TheLopais (226 views)
2015-05-06 13:32:48
List of Learning Resources
by SilverTiger
2015-05-05 10:20:32

How to: JGO Wiki
by Mac70
2015-02-17 20:56:16

2D Dynamic Lighting
by ThePixelPony
2015-01-01 20:25:42

How do I start Java Game Development?
by gouessej
2014-12-27 19:41:21

Resources for WIP games
by kpars
2014-12-18 10:26:14

Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00 is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!