Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (477)
Games in Android Showcase (107)
games submitted by our members
Games in WIP (534)
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 376 times)
0 Members and 1 Guest are viewing this topic.
Offline GlennBrann
« Posted 2013-12-11 14: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

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
   public static void saveGame(String path){
      try{
         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);
         
         os.writeBoolean(lvl1Complete);
         os.writeBoolean(lvl2Complete);
         os.writeBoolean(lvl3Complete);
         
         System.out.println("Game Saved.");
         os.close();
      }catch(Exception e){
         System.out.println("Could Not Save Game!");
         throw new RuntimeException(e);
      }
   }


Thanks
- GlennBrann
Online SHC
« Reply #1 - Posted 2013-12-11 14:46:09 »

What is the output it gave to the console?

Offline GlennBrann
« Reply #2 - Posted 2013-12-11 14: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 14: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 14: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 ?
Online SHC
« Reply #5 - Posted 2013-12-11 15:00:11 »

Run the JAR from the Command Prompt.

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

Offline GlennBrann
« Reply #6 - Posted 2013-12-11 15: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 15: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
Online SHC
« Reply #8 - Posted 2013-12-11 16: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 16: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.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

pw (35 views)
2014-07-24 01:59:36

Riven (33 views)
2014-07-23 21:16:32

Riven (21 views)
2014-07-23 21:07:15

Riven (24 views)
2014-07-23 20:56:16

ctomni231 (55 views)
2014-07-18 06:55:21

Zero Volt (47 views)
2014-07-17 23:47:54

danieldean (38 views)
2014-07-17 23:41:23

MustardPeter (43 views)
2014-07-16 23:30:00

Cero (59 views)
2014-07-16 00:42:17

Riven (56 views)
2014-07-14 18:02:53
HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54

HotSpot Options
by Roquen
2014-05-06 15:03:10

Escape Analysis
by Roquen
2014-04-29 22:16:43

Experimental Toys
by Roquen
2014-04-28 13:24:22
java-gaming.org 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‑gaming.org
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!