Arquivo jar

1 resposta
giselezr

oi pessoal, alguem pode me ajudar com essa questão?

Question 214
A class games.cards.Poker is correctly defined in the jar file Poker.jar.
A user wants to execute the main method of Poker on a UNIX system
using the command:
java games.cards.Poker

What allows the user to do this?
A. put Poker.jar in directory /stuff/java, and set the CLASSPATH to include /stuff/java
B. put Poker.jar in directory /stuff/java, and set the CLASSPATH to include /stuff/java/.jar
C. Put Poker.jar in directory /stuff/java, and set the CLASSPATH to include /stuff/java/Poker.jar
D. put Poker.jar in directory /stuff/java/games/cards, and set the CLASSPATH to include /stuff/java
E. put Poker.jar in directory /stuff/java/games/cards, and set the CLASSPATH to include /stuffijava/
.jar
F. put Poker.jar in directory /stuff/java/games/cards, and set the CLASSPATH to include /stuff/java/Poker.jar

A resposta certa é a C, podem não consgui entender por que a C.
Alguem pode me explicar?

abraço

1 Resposta

W

A situação diz que existe uma classe games.cards.Poker colocada num arquivo JAR chamado Poker.jar.

Isso significa que ao executar sua classe games.cards.Poker, você deverá previamente informar ao java a existência de Poker.jar como CLASSPATH.

Se você informar que Poker.jar para o CLASSPATH como /stuff/java/Poker.jar, então Poker.jar deverá colocar este no diretório /stuff/java/ para o java encontrar seu JAR e então encontrar games.cards.Poker.

Dentre as opções, realmente C é a correta porque um CLASSPATH deve receber o caminho completo do JAR, inclusive o próprio JAR ("/stuff/java/" + “Poker.jar”).

wiliamps

Criado 2 de outubro de 2012
Ultima resposta 2 de out. de 2012
Respostas 1
Participantes 2