Órai gyakorlat környezeti változók
This commit is contained in:
commit
a44271e8c9
10
Kornyezet/.classpath
Normal file
10
Kornyezet/.classpath
Normal file
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-16">
|
||||
<attributes>
|
||||
<attribute name="module" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
1
Kornyezet/.gitignore
vendored
Normal file
1
Kornyezet/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
/bin/
|
17
Kornyezet/.project
Normal file
17
Kornyezet/.project
Normal file
|
@ -0,0 +1,17 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>Kornyezet</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
14
Kornyezet/.settings/org.eclipse.jdt.core.prefs
Normal file
14
Kornyezet/.settings/org.eclipse.jdt.core.prefs
Normal file
|
@ -0,0 +1,14 @@
|
|||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=16
|
||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||
org.eclipse.jdt.core.compiler.compliance=16
|
||||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
|
||||
org.eclipse.jdt.core.compiler.release=enabled
|
||||
org.eclipse.jdt.core.compiler.source=16
|
46
Kornyezet/envvars.txt
Normal file
46
Kornyezet/envvars.txt
Normal file
|
@ -0,0 +1,46 @@
|
|||
USERDOMAIN_ROAMINGPROFILE GSZI
|
||||
LOCALAPPDATA C:\Users\pp\AppData\Local
|
||||
PROCESSOR_LEVEL 6
|
||||
CHROME_RESTART Google Chrome|Hmm. A Google Chrome összeomlott. Újraindítja most?|LEFT_TO_RIGHT
|
||||
USERDOMAIN GSZI
|
||||
FPS_BROWSER_APP_PROFILE_STRING Internet Explorer
|
||||
LOGONSERVER \\DAEDALUS
|
||||
SESSIONNAME Console
|
||||
ALLUSERSPROFILE C:\ProgramData
|
||||
PROCESSOR_ARCHITECTURE AMD64
|
||||
PSModulePath C:\Program Files\WindowsPowerShell\Modules;C:\Windows\system32\WindowsPowerShell\v1.0\Modules;C:\Program Files (x86)\Microsoft SQL Server\120\Tools\PowerShell\Modules\
|
||||
SystemDrive C:
|
||||
OneDrive C:\Users\pp\OneDrive
|
||||
PT8HOME C:\Program Files\Cisco Packet Tracer 8.0.1
|
||||
APPDATA C:\Users\pp\AppData\Roaming
|
||||
USERNAME pp
|
||||
USERDNSDOMAIN GSZI.LOCAL
|
||||
ProgramFiles(x86) C:\Program Files (x86)
|
||||
VBOX_MSI_INSTALL_PATH C:\Program Files\Oracle\VirtualBox\
|
||||
CHROME_CRASHPAD_PIPE_NAME \\.\pipe\crashpad_10416_YFBHHTGDWJIDFOXO
|
||||
CommonProgramFiles C:\Program Files\Common Files
|
||||
Path C:/Users/pp/.p2/pool/plugins/org.eclipse.justj.openjdk.hotspot.jre.full.win32.x86_64_17.0.0.v20211012-1059/jre/bin/server;C:/Users/pp/.p2/pool/plugins/org.eclipse.justj.openjdk.hotspot.jre.full.win32.x86_64_17.0.0.v20211012-1059/jre/bin;C:/Users/pp/AppData/Local/Temp/eoiCACF.tmp//plugins/org.eclipse.justj.openjdk.hotspot.jre.minimal.stripped.win32.x86_64_16.0.2.v20210721-1149/jre/bin/server;C:/Users/pp/AppData/Local/Temp/eoiCACF.tmp//plugins/org.eclipse.justj.openjdk.hotspot.jre.minimal.stripped.win32.x86_64_16.0.2.v20210721-1149/jre/bin;C:\Program Files (x86)\Google\Chrome\Application;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\Microsoft VS Code\bin;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\110\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files\Microsoft SQL Server\120\DTS\Binn\;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;C:\Program Files\Git\cmd;C:\Program Files\nodejs\;C:\Program Files\dotnet\;C:\Users\pp\AppData\Local\Microsoft\WindowsApps;;C:\Users\pp\Downloads;;C:\Users\pp\Downloads;
|
||||
FPS_BROWSER_USER_PROFILE_STRING Default
|
||||
PATHEXT .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
|
||||
DriverData C:\Windows\System32\Drivers\DriverData
|
||||
OS Windows_NT
|
||||
COMPUTERNAME Frey-tanari
|
||||
PROCESSOR_REVISION 3c03
|
||||
CommonProgramW6432 C:\Program Files\Common Files
|
||||
HOMESHARE \\JACKSON\gszi\Tanárok\pp
|
||||
ComSpec C:\Windows\system32\cmd.exe
|
||||
ProgramData C:\ProgramData
|
||||
ProgramW6432 C:\Program Files
|
||||
HOMEPATH \
|
||||
SystemRoot C:\Windows
|
||||
TEMP C:\Users\pp\AppData\Local\Temp
|
||||
HOMEDRIVE S:
|
||||
PROCESSOR_IDENTIFIER Intel64 Family 6 Model 60 Stepping 3, GenuineIntel
|
||||
USERPROFILE C:\Users\pp
|
||||
TMP C:\Users\pp\AppData\Local\Temp
|
||||
CommonProgramFiles(x86) C:\Program Files (x86)\Common Files
|
||||
ProgramFiles C:\Program Files
|
||||
PUBLIC C:\Users\Public
|
||||
NUMBER_OF_PROCESSORS 4
|
||||
windir C:\Windows
|
||||
=:: ::\
|
44
Kornyezet/src/kkk/Kornyezet.java
Normal file
44
Kornyezet/src/kkk/Kornyezet.java
Normal file
|
@ -0,0 +1,44 @@
|
|||
package kkk;
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.PrintWriter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
public class Kornyezet {
|
||||
|
||||
public static void main(String[] args) throws FileNotFoundException {
|
||||
Map<String, String> kornyezet = System.getenv();
|
||||
//kornyezet.entrySet().forEach(System.out::println);
|
||||
//egyetlen ismert környezeti változó lekérdezése
|
||||
System.out.println(System.getenv("USERNAME"));
|
||||
System.out.println(kornyezet.get("USERPROFILE"));
|
||||
//változók neveinek listája kiírás
|
||||
//kornyezet.keySet().forEach(System.out::println);
|
||||
|
||||
|
||||
ArrayList<String> vnevek = new ArrayList<>(kornyezet.keySet());
|
||||
//megoldás a listával
|
||||
PrintWriter pw1 = new PrintWriter("envvars1.txt");
|
||||
for (String nev : vnevek) {
|
||||
//pw1.println(nev+"\t"+kornyezet.get(nev));
|
||||
fajlbair(pw1, nev, kornyezet.get(nev));
|
||||
}
|
||||
pw1.close();
|
||||
|
||||
|
||||
//Megoldás lambda kifejezéssel
|
||||
PrintWriter pw = new PrintWriter("envvars.txt");
|
||||
kornyezet.forEach((vnev,ertek) -> pw.println(vnev+"\t"+ertek));
|
||||
pw.close();
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
static void fajlbair(PrintWriter pw, String vnev, String ertek) {
|
||||
pw.println(vnev+"\t"+ertek);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user