Quantcast
Channel: Programação - GUJ
Viewing all articles
Browse latest Browse all 33093

java.io.FileNotFoundException

$
0
0

@oitathi escreveu:

Eu fiz um projeto no eclipse que está rodando perfeitamente por lá.
Porém, quando gero o jar e tento rodar por linha de comando o seguinte erro aparece:

java.io.FileNotFoundException: resources\maps\empresa (O sistema não pode encont
rar o caminho especificado)
at java.io.FileInputStream.open0(Native Method)
at java.io.FileInputStream.open(Unknown Source)
at java.io.FileInputStream.(Unknown Source)
at br.com.accenture.controller.utils.FileUtils.leMapaTxt(FileUtils.java:
62)
at br.com.accenture.controller.utils.FileUtils.carregaBase(FileUtils.jav
a:45)
at br.com.accenture.controller.utils.FileUtils.(FileUtils.java:40)

    at br.com.accenture.controller.utils.TelaUtils.<init>(TelaUtils.java:17)

    at br.com.aceenture.view.PanelInsercao.<init>(PanelInsercao.java:86)
    at br.com.aceenture.view.TelaForm.<init>(TelaForm.java:62)
    at br.com.aceenture.view.TelaForm.main(TelaForm.java:39)

Exception in thread "main" java.lang.NullPointerException
at br.com.accenture.controller.utils.FileUtils.carregaBase(FileUtils.jav
a:46)
at br.com.accenture.controller.utils.FileUtils.(FileUtils.java:40)

    at br.com.accenture.controller.utils.TelaUtils.<init>(TelaUtils.java:17)

    at br.com.aceenture.view.PanelInsercao.<init>(PanelInsercao.java:86)
    at br.com.aceenture.view.TelaForm.<init>(TelaForm.java:62)
    at br.com.aceenture.view.TelaForm.main(TelaForm.java:39)`

Na minha classe está assim:

private void carregaBase() {
		try {
			ObjectInputStream s = leMapaTxt("resources/maps/empresa");
			this.empresaSiglaMap = (Map<String, Map<String, Site>>) s.readObject();
			
			s = leMapaTxt("resources/maps/servico");
			this.empresaRegionalIdServicoMap = (Map<String, Map<String, Map<Double,Servico>>>)s.readObject();
			s.close();
		} catch (IOException e) {
			e.printStackTrace();
		} catch (ClassNotFoundException e) {
			e.printStackTrace();
		}
	}

meu projeto esta com essa estrutura:

Como eu disse, pelo eclipse roda normal. Alguém saberia o motivo de não rodar pelo jar?

Mensagens: 4

Participantes: 3

Ler tópico completo


Viewing all articles
Browse latest Browse all 33093


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>